You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
101 lines
3.4 KiB
101 lines
3.4 KiB
---
|
|
|
|
- name: Build the list of packages for core PHP
|
|
set_fact:
|
|
php_pkg: "{{ php_pkg|default([]) }} + [ 'php-{{ item }}' ]"
|
|
with_items:
|
|
- "{{ httpd_php_common_modules }}"
|
|
tags: [package,web]
|
|
|
|
- name: Build the list of packages for scl PHP
|
|
set_fact:
|
|
php_pkg: "{{ php_pkg|default([]) }} + [ 'php{{ item.0 }}-php-{{ item.1 }}' ]"
|
|
with_nested:
|
|
- "{{ httpd_php_versions.keys() | list | difference([ 54 ]) }}"
|
|
- "{{ httpd_php_common_modules }}"
|
|
tags: [package,web]
|
|
|
|
- name: Install PHP main modules
|
|
yum: name={{ php_pkg }}
|
|
notify:
|
|
- systemd-tmpfiles
|
|
- restart php-fpm
|
|
tags: [package,web]
|
|
|
|
- name: Install PHP extra modules
|
|
yum: name={{ httpd_php_extra_modules }} state=present
|
|
notify: restart php-fpm
|
|
tags: [package,web]
|
|
|
|
- name: Create tmpfiles.d fragment
|
|
copy: src=tmpfiles.conf dest=/etc/tmpfiles.d/php-fpm-scl.conf
|
|
notify: systemd-tmpfiles
|
|
tags: web
|
|
|
|
- name: Disable default FPM pools
|
|
template: src=default_fpm_pool.conf.j2 dest={{ httpd_php_versions[item].conf_path }}/php-fpm.d/www.conf
|
|
with_items: "{{ httpd_php_versions.keys() | list }}"
|
|
notify: restart php-fpm
|
|
tags: [conf,web]
|
|
|
|
- name: Deploy main php.ini configuration
|
|
template: src=php.ini.j2 dest={{ httpd_php_versions[item].conf_path }}/php.ini
|
|
with_items: "{{ httpd_php_versions.keys() | list }}"
|
|
notify: restart php-fpm
|
|
tags: [conf,web]
|
|
|
|
- name: Deploy PHP FPM master's configuration
|
|
template: src=php-fpm.conf.j2 dest={{ httpd_php_versions[item].conf_path }}/php-fpm.conf
|
|
with_items: "{{ httpd_php_versions.keys() | list }}"
|
|
notify: restart php-fpm
|
|
tags: [conf,web]
|
|
|
|
- name: Deploy default PHP FPM pools configurations
|
|
template: src=php_fpm_pool.conf.j2 dest={{ httpd_php_versions[item].conf_path }}/php-fpm.d/php{{ item }}.conf
|
|
with_items: "{{ httpd_php_versions.keys() | list }}"
|
|
notify: restart php-fpm
|
|
tags: [conf,web]
|
|
|
|
- name: Create user accounts for ansible PHP FPM pools
|
|
user: name={{ item }} comment="PHP FPM {{ item }}" system=yes shell=/sbin/nologin
|
|
with_items: "{{ httpd_php_ansible_pools | default([]) | selectattr('user', 'defined') | map(attribute='user') | list }}"
|
|
tags: [conf,web]
|
|
|
|
- name: Deploy ansible PHP FPM pools configurations
|
|
template: src=php_fpm_ansible_pools.conf.j2 dest={{ httpd_php_versions[item].conf_path }}/php-fpm.d/ansible_pools.conf
|
|
with_items: "{{ httpd_php_versions.keys() | list }}"
|
|
notify: restart php-fpm
|
|
tags: [conf,web]
|
|
|
|
- name: Create log directories
|
|
file: path=/var/log/php/php{{ item }} state=directory mode=770 owner=root group={{ httpd_user }}
|
|
with_items: "{{ httpd_php_versions.keys() | list }}"
|
|
notify: restart php-fpm
|
|
tags: [conf,web]
|
|
|
|
- name: Start and enable core PHP FPM service
|
|
service: name=php-fpm state=started enabled=yes
|
|
tags: web
|
|
|
|
- name: Start and enable SCL PHP FPM services
|
|
service: name=php{{ item }}-php-fpm state=started enabled=yes
|
|
with_items: "{{ httpd_php_versions.keys() | list | difference([ 54 ]) }}"
|
|
tags: web
|
|
|
|
- name: Deploy httpd configuration fragments
|
|
template: src={{ item.src }} dest={{ item.dest }}
|
|
with_items:
|
|
- { src: httpd_php.conf.j2, dest: /etc/httpd/ansible_conf.d/php.conf }
|
|
notify: reload httpd
|
|
tags: [conf,web]
|
|
|
|
- name: Allow network connections in SELinux
|
|
seboolean: name={{ item }} state=yes persistent=yes
|
|
with_items:
|
|
- httpd_can_network_connect_db
|
|
- httpd_can_network_memcache
|
|
- httpd_can_network_connect
|
|
- httpd_can_sendmail
|
|
when: ansible_selinux.status == 'enabled'
|
|
tags: web
|
|
...
|
|
|