Add configurations to all possible conf directories

This commit is contained in:
Oskar Schöldström 2016-03-03 21:24:26 -05:00
parent 47e34b2268
commit a1dd9901ec
6 changed files with 43 additions and 21 deletions

View File

@ -4,38 +4,41 @@
path: "{{ item }}" path: "{{ item }}"
state: directory state: directory
follow: true follow: true
with_items: with_flattened:
- "{{ php_conf_path }}" - "{{ php_conf_paths }}"
- "{{ php_extension_conf_path }}" - "{{ php_extension_conf_paths }}"
- name: Place PHP configuration file in place. - name: Place PHP configuration file in place.
template: template:
src: php.ini.j2 src: php.ini.j2
dest: "{{ php_conf_path }}/php.ini" dest: "{{ item }}/php.ini"
owner: root owner: root
group: root group: root
mode: 0644 mode: 0644
with_items: "{{ php_conf_paths }}"
notify: restart webserver notify: restart webserver
when: php_use_managed_ini when: php_use_managed_ini
- name: Place APC configuration file in place. - name: Place APC configuration file in place.
template: template:
src: apc.ini.j2 src: apc.ini.j2
dest: "{{ php_extension_conf_path }}/{{ php_apc_conf_filename }}" dest: "{{ item }}/{{ php_apc_conf_filename }}"
owner: root owner: root
group: root group: root
force: yes force: yes
mode: 0644 mode: 0644
with_items: "{{ php_extension_conf_paths }}"
when: php_enable_apc when: php_enable_apc
notify: restart webserver notify: restart webserver
- name: Place OpCache configuration file in place. - name: Place OpCache configuration file in place.
template: template:
src: opcache.ini.j2 src: opcache.ini.j2
dest: "{{ php_extension_conf_path }}/{{ php_opcache_conf_filename }}" dest: "{{ item }}/{{ php_opcache_conf_filename }}"
owner: root owner: root
group: root group: root
force: yes force: yes
mode: 0644 mode: 0644
with_items: "{{ php_extension_conf_paths }}"
when: php_opcache_enable when: php_opcache_enable
notify: restart webserver notify: restart webserver

View File

@ -132,14 +132,14 @@
- name: Ensure php-fpm config directory exists. - name: Ensure php-fpm config directory exists.
file: file:
path: "{{ php_conf_path }}/fpm" path: "{{ php_fpm_conf_path }}"
state: directory state: directory
when: "'--enable-fpm' in php_source_configure_command" when: "'--enable-fpm' in php_source_configure_command"
- name: Ensure php-fpm config file is installed. - name: Ensure php-fpm config file is installed.
template: template:
src: php-fpm.conf.j2 src: php-fpm.conf.j2
dest: "{{ php_conf_path }}/fpm/php-fpm.conf" dest: "{{ php_fpm_conf_path }}/php-fpm.conf"
mode: 0644 mode: 0644
when: "'--enable-fpm' in php_source_configure_command" when: "'--enable-fpm' in php_source_configure_command"
notify: restart php-fpm notify: restart php-fpm

View File

@ -13,15 +13,15 @@
php_webserver_daemon: "{{ __php_webserver_daemon }}" php_webserver_daemon: "{{ __php_webserver_daemon }}"
when: php_webserver_daemon is not defined when: php_webserver_daemon is not defined
- name: Define php_conf_path. - name: Define php_conf_paths.
set_fact: set_fact:
php_conf_path: "{{ __php_conf_path }}" php_conf_paths: "{{ __php_conf_paths }}"
when: php_conf_path is not defined when: php_conf_paths is not defined
- name: Define php_extension_conf_path. - name: Define php_extension_conf_paths.
set_fact: set_fact:
php_extension_conf_path: "{{ __php_extension_conf_path }}" php_extension_conf_paths: "{{ __php_extension_conf_paths }}"
when: php_extension_conf_path is not defined when: php_extension_conf_paths is not defined
- name: Define php_apc_conf_filename. - name: Define php_apc_conf_filename.
set_fact: set_fact:
@ -33,6 +33,11 @@
php_opcache_conf_filename: "{{ __php_opcache_conf_filename }}" php_opcache_conf_filename: "{{ __php_opcache_conf_filename }}"
when: php_opcache_conf_filename is not defined when: php_opcache_conf_filename is not defined
- name: Define php_fpm_conf_path.
set_fact:
php_fpm_conf_path: "{{ __php_fpm_conf_path }}"
when: php_fpm_conf_path is not defined
# Setup/install tasks. # Setup/install tasks.
- include: setup-RedHat.yml - include: setup-RedHat.yml
when: (php_install_from_source == false) and (ansible_os_family == 'RedHat') when: (php_install_from_source == false) and (ansible_os_family == 'RedHat')

View File

@ -12,14 +12,16 @@
- name: Delete APC configuration file if this role will provide one. - name: Delete APC configuration file if this role will provide one.
file: file:
path: "{{ php_extension_conf_path }}/{{ php_apc_conf_filename }}" path: "{{ item }}/{{ php_apc_conf_filename }}"
state: absent state: absent
with_items: "{{ php_extension_conf_paths }}"
when: php_enable_apc and php_package_install.changed when: php_enable_apc and php_package_install.changed
notify: restart webserver notify: restart webserver
- name: Delete OpCache configuration file if this role will provide one. - name: Delete OpCache configuration file if this role will provide one.
file: file:
path: "{{ php_extension_conf_path }}/{{ php_opcache_conf_filename }}" path: "{{ item }}/{{ php_opcache_conf_filename }}"
state: absent state: absent
with_items: "{{ php_extension_conf_paths }}"
when: php_opcache_enable and php_package_install.changed when: php_opcache_enable and php_package_install.changed
notify: restart webserver notify: restart webserver

View File

@ -14,10 +14,18 @@ __php_packages:
__php_webserver_daemon: "apache2" __php_webserver_daemon: "apache2"
# Vendor-specific configuration paths on Debian/Ubuntu make my brain asplode. # Vendor-specific configuration paths on Debian/Ubuntu make my brain asplode.
__php_conf_path: "{{ '/etc/php5/fpm' if php_enable_webserver and php_enable_php_fpm else '/etc/php5/apache2' if php_enable_webserver and php_webserver_daemon == 'apache2' else '/etc/php5/cli' }}" __php_conf_paths:
__php_extension_conf_path: "{{ __php_conf_path }}/conf.d" - /etc/php5/fpm
- /etc/php5/apache2
- /etc/php5/cli
__php_extension_conf_paths:
- /etc/php5/fpm/conf.d
- /etc/php5/apache2/conf.d
- /etc/php5/cli/conf.d
__php_apc_conf_filename: 20-apcu.ini __php_apc_conf_filename: 20-apcu.ini
__php_opcache_conf_filename: 05-opcache.ini __php_opcache_conf_filename: 05-opcache.ini
__php_fpm_daemon: php5-fpm __php_fpm_daemon: php5-fpm
__php_fpm_pool_conf_path: "/etc/php5/fpm/pool.d/www.conf" __php_fpm_conf_path: "/etc/php5/fpm"
__php_fpm_pool_conf_path: "{{ __php_fpm_conf_path }}/pool.d/www.conf"

View File

@ -17,10 +17,14 @@ __php_packages:
- php-xmlrpc - php-xmlrpc
__php_webserver_daemon: "httpd" __php_webserver_daemon: "httpd"
__php_conf_path: /etc __php_conf_paths:
php_extension_conf_path: /etc/php.d - /etc
__php_extension_conf_paths:
- /etc/php.d
__php_apc_conf_filename: 50-apc.ini __php_apc_conf_filename: 50-apc.ini
__php_opcache_conf_filename: 10-opcache.ini __php_opcache_conf_filename: 10-opcache.ini
__php_fpm_daemon: php-fpm __php_fpm_daemon: php-fpm
__php_fpm_conf_path: "/etc/fpm"
__php_fpm_pool_conf_path: "/etc/php-fpm.d/www.conf" __php_fpm_pool_conf_path: "/etc/php-fpm.d/www.conf"