Add configuration for multi PHP setup

This commit is contained in:
Tristan PILAT 2019-06-04 15:48:21 +02:00
parent 08ae9d73c4
commit edad3a7ce7
7 changed files with 34 additions and 0 deletions

View File

@ -11,6 +11,7 @@ evoadmin_host: "evoadmin.{{ ansible_fqdn }}"
evoadmin_username: evoadmin
evoadmin_enable_vhost: True
evoadmin_multi_php: False
evoadmin_tpl_servername: "{{ ansible_fqdn }}"
evoadmin_tpl_address: "{{ ansible_default_ipv4.address }}"

View File

@ -0,0 +1,10 @@
#!/usr/bin/env bash
evolixContainerVersion=$(grep SetHandler /etc/apache2/sites-enabled/$LOGNAME.conf 2>/dev/null | grep -m 1 -o 'fpm[0-9][0-9]' | head -n 1 | sed 's/php//g' | sed 's/fpm//g')
if [ "$evolixContainerVersion" != "" ]; then
lxc-attach -n php$evolixContainerVersion -- su - $LOGNAME -c "cd \"${PWD@E}\" && php ${*@Q}"
else
# TODO: fallback?
# command php $*
echo "could not determine \$evolixContainerVersion"
exit 1
fi

View File

@ -15,3 +15,10 @@
template:
src: web-mail.tpl.j2
dest: "{{ evoadmin_scripts_dir }}/web-mail.tpl"
- name: Copy multi php-cli script
file:
src: phpContainer
dest: /usr/local/bin/phpContainer
mode: 0700
when: evoadmin_multi_php == True

View File

@ -107,3 +107,9 @@
dest: /etc/sudoers.d/evoadmin
mode: "0600"
validate: "visudo -cf %s"
- name: Modify bashrc skel file
lineinfile:
dest: /etc/skel/.bashrc
line: "alias php='sudo /usr/local/bin/phpContainer'"
when: evoadmin_multi_php == True

View File

@ -10,3 +10,6 @@ $localconf['cluster'] = FALSE;
$oriconf['logins'] = array();
//$oriconf['logins']['foo'] = 'd5d3c723fb82cb0078f399888af78204234535ec2ef3da56710fdd51f90d2477';
//$oriconf['logins']['bar'] = '7938c84d6e43d1659612a7ea7c1101ed02e52751bb64597a8c20ebaba8ba4303';
{% if evoadmin_multi_php == "True" %}
$localconf['php_versions'] = array(56, 70, 73);
{% endif %}

View File

@ -1,3 +1,7 @@
User_Alias EVOADMIN = www-evoadmin
Cmnd_Alias EVOADMIN_WEB = {{ evoadmin_scripts_dir | mandatory }}/web-*.sh, {{ evoadmin_scripts_dir | mandatory }}/ftpadmin.sh, {{ evoadmin_scripts_dir | mandatory }}/dbadmin.sh
EVOADMIN ALL=NOPASSWD: EVOADMIN_WEB
{% if evoadmin_multi_php == "True" %}
Defaults env_keep += "LOGNAME PWD"
ALL ALL = NOPASSWD: /usr/local/bin/phpContainer
{% endif %}

View File

@ -1,2 +1,5 @@
CONTACT_MAIL="{{ evoadmin_contact_email or general_alert_email | mandatory }}"
WWWBOUNCE_MAIL="{{ evoadmin_bounce_email or general_alert_email | mandatory }}"
{% if evoadmin_multi_php == "True" %}
PHP_VERSIONS=(56 70 73)
{% endif %}