diff --git a/README.md b/README.md index 975d655..bc9e7bc 100644 --- a/README.md +++ b/README.md @@ -58,7 +58,7 @@ Whether to enable APC. Other APC variables will be ineffective if this is set to php_apc_enabled_in_ini: false -When installing APC, depending on the system and whether running PHP as a webserver module or standalone via `php-fpm`, you might need the line `extension=apc.so` in `apc.ini`. If you need that line added, set this variable to true. +When installing APC, depending on the system and whether running PHP as a webserver module or standalone via `php-fpm`, you might need the line `extension=apc.so` in `apc.ini`. If you need that line added (e.g. you're running `php-fpm`), set this variable to true. php_apc_cache_by_default: "1" php_apc_shm_size: "96M" diff --git a/handlers/main.yml b/handlers/main.yml index 002277b..454476d 100644 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -3,6 +3,7 @@ service: name: "{{ php_webserver_daemon }}" state: restarted + notify: restart php-fpm when: php_enable_webserver - name: restart php-fpm diff --git a/tasks/configure.yml b/tasks/configure.yml index cbfdbaa..71c5285 100644 --- a/tasks/configure.yml +++ b/tasks/configure.yml @@ -23,6 +23,7 @@ dest: "{{ php_extension_conf_path }}/{{ php_apc_conf_filename }}" owner: root group: root + force: yes mode: 0644 when: php_enable_apc notify: restart webserver diff --git a/tasks/main.yml b/tasks/main.yml index b0bf693..4ae5688 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -13,6 +13,16 @@ php_webserver_daemon: "{{ __php_webserver_daemon }}" when: php_webserver_daemon is not defined +- name: Define php_conf_path. + set_fact: + php_conf_path: "{{ __php_conf_path }}" + when: php_conf_path is not defined + +- name: Define php_extension_conf_path. + set_fact: + php_extension_conf_path: "{{ __php_extension_conf_path }}" + when: php_extension_conf_path is not defined + # Setup/install tasks. - include: setup-RedHat.yml when: ansible_os_family == 'RedHat' diff --git a/vars/Debian.yml b/vars/Debian.yml index 40530bc..7a829a2 100644 --- a/vars/Debian.yml +++ b/vars/Debian.yml @@ -1,8 +1,4 @@ --- -php_conf_path: /etc/php5/apache2 -php_extension_conf_path: /etc/php5/apache2/conf.d -php_apc_conf_filename: 20-apc.ini -php_fpm_daemon: php5-fpm __php_packages: - php5 - libapache2-mod-php5 @@ -15,3 +11,10 @@ __php_packages: - php5-gd - php-pear __php_webserver_daemon: "apache2" + +# Vendor-specific configuration paths on Debian/Ubuntu make my brain asplode. +__php_conf_path: "{{ '/etc/php5' if php_webserver_daemon and php_webserver_daemon != 'apache2' else '/etc/php5/apache2' }}" +__php_extension_conf_path: "{{ __php_conf_path }}/conf.d" + +php_apc_conf_filename: 20-apc.ini +php_fpm_daemon: php5-fpm diff --git a/vars/RedHat.yml b/vars/RedHat.yml index 2d125d3..0ae5e8c 100644 --- a/vars/RedHat.yml +++ b/vars/RedHat.yml @@ -1,8 +1,4 @@ --- -php_conf_path: /etc -php_extension_conf_path: /etc/php.d -php_apc_conf_filename: apc.ini -php_fpm_daemon: php-fpm __php_packages: - ImageMagick - php @@ -20,3 +16,9 @@ __php_packages: - php-xml - php-xmlrpc __php_webserver_daemon: "httpd" + +__php_conf_path: /etc +__php_extension_conf_path: /etc/php.d + +php_apc_conf_filename: apc.ini +php_fpm_daemon: php-fpm