Split php.ini config for CLI/FPM

pull/5/head 1.0
Emilien Mantel 2015-08-28 09:48:25 +02:00
parent e35f77089a
commit 7e5d2a5258
4 changed files with 24 additions and 2 deletions

View File

@ -21,7 +21,19 @@ You should look at [default vars](defaults/main.yml).
- `php_install_fpm`: boolean, install and manage php-fpm (default is true) - `php_install_fpm`: boolean, install and manage php-fpm (default is true)
- `php_install_xdebug`: boolean, install [Xdebug](http://xdebug.org) - `php_install_xdebug`: boolean, install [Xdebug](http://xdebug.org)
- `php_extra_packages`: additional php packages to install (default is an empty list). - `php_extra_packages`: additional php packages to install (default is an empty list).
- `php_ini`: manage php.ini (php-fpm), as key/value.
#### php.ini
- `php_ini`: global configuration shared beween FPM/CLI
- `php_ini_fpm`: manage FPM php.ini (php-fpm)
- `php_ini_cli`: manage CLI php.ini (php-fpm)
Note:
- If you want exactly same configuration for CLI/FPM. You can put all your data in `php_ini`.
- Put specific configuration in `php_ini_fpm`/`php_ini_cli`.
- You can override with `php_ini_fpm`/`php_ini_cli`, but it breaks idempotence.
#### OpCache settings (PHP >= 5.5) #### OpCache settings (PHP >= 5.5)

View File

@ -12,6 +12,8 @@ php_ini:
value: 'Off' value: 'Off'
- key: 'memory_limit' - key: 'memory_limit'
value: '256M' value: '256M'
php_ini_fpm: []
php_ini_cli: []
# OpCache settings (PHP >= 5.5) # OpCache settings (PHP >= 5.5)
php_opcache_enable: "1" php_opcache_enable: "1"

View File

@ -5,7 +5,9 @@
- name: LINEINFILE | PHP configuration - name: LINEINFILE | PHP configuration
lineinfile: dest=/etc/php5/fpm/php.ini regexp='^;?{{ item.key }}' line='{{ item.key }} = {{ item.value }}' lineinfile: dest=/etc/php5/fpm/php.ini regexp='^;?{{ item.key }}' line='{{ item.key }} = {{ item.value }}'
with_items: php_ini with_flattened:
- php_ini
- php_ini_fpm
notify: restart php-fpm notify: restart php-fpm
- name: TEMPLATE | Deploy pool configuration - name: TEMPLATE | Deploy pool configuration

View File

@ -15,6 +15,12 @@
include: fpm.yml include: fpm.yml
when: php_install_fpm when: php_install_fpm
- name: LINEINFILE | PHP configuration
lineinfile: dest=/etc/php5/cli/php.ini regexp='^;?{{ item.key }}' line='{{ item.key }} = {{ item.value }}'
with_flattened:
- php_ini
- php_ini_cli
- name: INCLUDE | Xdebug - name: INCLUDE | Xdebug
include: xdebug.yml include: xdebug.yml
when: php_install_xdebug when: php_install_xdebug