mirror of
https://github.com/geerlingguy/ansible-role-php.git
synced 2025-04-18 20:46:58 +02:00
Merge pull request #89 from oxyc/conf
Apply configurations to all possible conf directories on Debian
This commit is contained in:
commit
f195d7ec9a
@ -80,6 +80,9 @@ script:
|
||||
- 'sudo docker exec --tty "$(cat ${container_id})" env TERM=xterm php --version'
|
||||
- 'sudo docker exec --tty "$(cat ${container_id})" env TERM=xterm /usr/bin/php --version | grep -qF "PHP $PHP_VERSION"'
|
||||
|
||||
# Ensure PHP configurations have taken effect.
|
||||
- sudo docker exec --tty "$(cat ${container_id})" env TERM=xterm php -i | grep 'memory_limit.*192'
|
||||
|
||||
# Clean up
|
||||
- 'sudo docker stop "$(cat ${container_id})"'
|
||||
|
||||
|
@ -77,7 +77,7 @@ php_source_make_command: "make"
|
||||
php_source_configure_command: >
|
||||
./configure
|
||||
--prefix={{ php_source_install_path }}
|
||||
--with-config-file-path={{ php_conf_path }}
|
||||
--with-config-file-path={{ php_conf_paths | first }}
|
||||
--enable-mbstring
|
||||
--enable-zip
|
||||
--enable-bcmath
|
||||
|
@ -4,38 +4,41 @@
|
||||
path: "{{ item }}"
|
||||
state: directory
|
||||
follow: true
|
||||
with_items:
|
||||
- "{{ php_conf_path }}"
|
||||
- "{{ php_extension_conf_path }}"
|
||||
with_flattened:
|
||||
- "{{ php_conf_paths }}"
|
||||
- "{{ php_extension_conf_paths }}"
|
||||
|
||||
- name: Place PHP configuration file in place.
|
||||
template:
|
||||
src: php.ini.j2
|
||||
dest: "{{ php_conf_path }}/php.ini"
|
||||
dest: "{{ item }}/php.ini"
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0644
|
||||
with_items: "{{ php_conf_paths }}"
|
||||
notify: restart webserver
|
||||
when: php_use_managed_ini
|
||||
|
||||
- name: Place APC configuration file in place.
|
||||
template:
|
||||
src: apc.ini.j2
|
||||
dest: "{{ php_extension_conf_path }}/{{ php_apc_conf_filename }}"
|
||||
dest: "{{ item }}/{{ php_apc_conf_filename }}"
|
||||
owner: root
|
||||
group: root
|
||||
force: yes
|
||||
mode: 0644
|
||||
with_items: "{{ php_extension_conf_paths }}"
|
||||
when: php_enable_apc
|
||||
notify: restart webserver
|
||||
|
||||
- name: Place OpCache configuration file in place.
|
||||
template:
|
||||
src: opcache.ini.j2
|
||||
dest: "{{ php_extension_conf_path }}/{{ php_opcache_conf_filename }}"
|
||||
dest: "{{ item }}/{{ php_opcache_conf_filename }}"
|
||||
owner: root
|
||||
group: root
|
||||
force: yes
|
||||
mode: 0644
|
||||
with_items: "{{ php_extension_conf_paths }}"
|
||||
when: php_opcache_enable
|
||||
notify: restart webserver
|
||||
|
@ -137,14 +137,14 @@
|
||||
|
||||
- name: Ensure php-fpm config directory exists.
|
||||
file:
|
||||
path: "{{ php_conf_path }}/fpm"
|
||||
path: "{{ php_fpm_conf_path }}"
|
||||
state: directory
|
||||
when: "'--enable-fpm' in php_source_configure_command"
|
||||
|
||||
- name: Ensure php-fpm config file is installed.
|
||||
template:
|
||||
src: php-fpm.conf.j2
|
||||
dest: "{{ php_conf_path }}/fpm/php-fpm.conf"
|
||||
dest: "{{ php_fpm_conf_path }}/php-fpm.conf"
|
||||
mode: 0644
|
||||
when: "'--enable-fpm' in php_source_configure_command"
|
||||
notify: restart php-fpm
|
||||
|
@ -13,15 +13,15 @@
|
||||
php_webserver_daemon: "{{ __php_webserver_daemon }}"
|
||||
when: php_webserver_daemon is not defined
|
||||
|
||||
- name: Define php_conf_path.
|
||||
- name: Define php_conf_paths.
|
||||
set_fact:
|
||||
php_conf_path: "{{ __php_conf_path }}"
|
||||
when: php_conf_path is not defined
|
||||
php_conf_paths: "{{ __php_conf_paths }}"
|
||||
when: php_conf_paths is not defined
|
||||
|
||||
- name: Define php_extension_conf_path.
|
||||
- name: Define php_extension_conf_paths.
|
||||
set_fact:
|
||||
php_extension_conf_path: "{{ __php_extension_conf_path }}"
|
||||
when: php_extension_conf_path is not defined
|
||||
php_extension_conf_paths: "{{ __php_extension_conf_paths }}"
|
||||
when: php_extension_conf_paths is not defined
|
||||
|
||||
- name: Define php_apc_conf_filename.
|
||||
set_fact:
|
||||
@ -33,6 +33,11 @@
|
||||
php_opcache_conf_filename: "{{ __php_opcache_conf_filename }}"
|
||||
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.
|
||||
- include: setup-RedHat.yml
|
||||
when: (php_install_from_source == false) and (ansible_os_family == 'RedHat')
|
||||
|
@ -12,14 +12,16 @@
|
||||
|
||||
- name: Delete APC configuration file if this role will provide one.
|
||||
file:
|
||||
path: "{{ php_extension_conf_path }}/{{ php_apc_conf_filename }}"
|
||||
path: "{{ item }}/{{ php_apc_conf_filename }}"
|
||||
state: absent
|
||||
with_items: "{{ php_extension_conf_paths }}"
|
||||
when: php_enable_apc and php_package_install.changed
|
||||
notify: restart webserver
|
||||
|
||||
- name: Delete OpCache configuration file if this role will provide one.
|
||||
file:
|
||||
path: "{{ php_extension_conf_path }}/{{ php_opcache_conf_filename }}"
|
||||
path: "{{ item }}/{{ php_opcache_conf_filename }}"
|
||||
state: absent
|
||||
with_items: "{{ php_extension_conf_paths }}"
|
||||
when: php_opcache_enable and php_package_install.changed
|
||||
notify: restart webserver
|
||||
|
@ -15,7 +15,7 @@ PATH=/sbin:/usr/sbin:/bin:/usr/bin
|
||||
DESC="PHP FastCGI Process Manager"
|
||||
NAME={{ php_fpm_daemon }}
|
||||
DAEMON=/usr/sbin/$NAME
|
||||
DAEMON_ARGS="--daemonize --fpm-config {{ php_conf_path }}/fpm/php-fpm.conf"
|
||||
DAEMON_ARGS="--daemonize --fpm-config {{ php_fpm_conf_path }}/php-fpm.conf"
|
||||
PIDFILE=/var/run/{{ php_fpm_daemon }}.pid
|
||||
TIMEOUT=30
|
||||
SCRIPTNAME=/etc/init.d/$NAME
|
||||
|
@ -2,7 +2,7 @@
|
||||
; FPM Configuration ;
|
||||
;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
include={{ php_conf_path }}/fpm/pool.d/*.conf
|
||||
include={{ php_fpm_conf_path }}/pool.d/*.conf
|
||||
|
||||
;;;;;;;;;;;;;;;;;;
|
||||
; Global Options ;
|
||||
|
@ -4,6 +4,7 @@
|
||||
vars:
|
||||
php_enable_webserver: false
|
||||
php_version: 5.6
|
||||
php_memory_limit: "192M"
|
||||
php_enablerepo: "remi,remi-php56"
|
||||
|
||||
pre_tasks:
|
||||
|
@ -7,6 +7,7 @@
|
||||
php_source_clone_dir: /root/php-src
|
||||
php_source_make_command: "make --jobs=2"
|
||||
php_source_version: "php-7.0.3"
|
||||
php_memory_limit: "192M"
|
||||
|
||||
pre_tasks:
|
||||
- name: Ensure build dependencies are installed (RedHat).
|
||||
|
@ -14,10 +14,18 @@ __php_packages:
|
||||
__php_webserver_daemon: "apache2"
|
||||
|
||||
# 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_extension_conf_path: "{{ __php_conf_path }}/conf.d"
|
||||
__php_conf_paths:
|
||||
- /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_opcache_conf_filename: 05-opcache.ini
|
||||
__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"
|
||||
|
@ -17,10 +17,14 @@ __php_packages:
|
||||
- php-xmlrpc
|
||||
__php_webserver_daemon: "httpd"
|
||||
|
||||
__php_conf_path: /etc
|
||||
php_extension_conf_path: /etc/php.d
|
||||
__php_conf_paths:
|
||||
- /etc
|
||||
|
||||
__php_extension_conf_paths:
|
||||
- /etc/php.d
|
||||
|
||||
__php_apc_conf_filename: 50-apc.ini
|
||||
__php_opcache_conf_filename: 10-opcache.ini
|
||||
__php_fpm_daemon: php-fpm
|
||||
__php_fpm_conf_path: "/etc/fpm"
|
||||
__php_fpm_pool_conf_path: "/etc/php-fpm.d/www.conf"
|
||||
|
Loading…
Reference in New Issue
Block a user