Files
ansible/roles/apache_php/tasks/main.yml
2025-10-10 11:07:34 +00:00

66 lines
1.8 KiB
YAML

---
- name: Install PHP packages
apt:
pkg:
- "{{ apache_phpfpm_php }}-fpm"
- php-apcu
# check_php-fpm nagios plugin dependencies:
- libany-moose-perl
- libjson-perl
- libjson-xs-perl
state: present
tags: packages
- name: Disable Apache modules
apache2_module: name="{{ item }}" state=absent force=yes
with_items:
- "{{ apache_phpfpm_php }}"
notify: Restart Apache
tags: configs
- name: Enable Apache modules
apache2_module: name="{{ item }}" state=present force=yes
with_items:
- proxy_fcgi
notify: Restart Apache
tags: configs
- name: Ensure mod-php is not installed
apt:
pkg:
- libapache2-mod-{{ apache_phpfpm_php }}
- "{{ apache_phpfpm_php }}-cgi"
state: absent
purge: yes
notify: Restart Apache
tags: packages
- name: Install Apache other configs
template: src="etc_apache2_conf-available_php-fpm.conf.j2" dest="/etc/apache2/conf-available/{{ apache_phpfpm_php }}-fpm.conf"
notify: Reload Apache
tags: configs
- name: Install PHP-FPM pool config
template: src=etc_php_fpm_pool.d_www.conf.j2 dest={{ apache_phpfpm_etc_dir }}/pool.d/www.conf
notify: Reload PHP-FPM
tags: configs
- name: Install the FGCI client script
template: src=usr_local_bin_fcgi-client dest=/usr/local/bin/fcgi-client mode=0755
- name: Enable PHP-FPM
file: dest=/etc/apache2/conf-enabled/{{ apache_phpfpm_php }}-fpm.conf src=../conf-available/{{ apache_phpfpm_php }}-fpm.conf state=link
notify: Reload Apache
tags: configs
- name: Ensure PHP-FPM is running
service: name={{ apache_phpfpm_php }}-fpm state=started enabled=yes
tags: configs
- name: Register the php-fpm service in Consul
template: dest=/etc/consul.d/service-php-fpm.hcl src=etc_consul.d_service-php-fpm.hcl.j2
when: apache_consul_service
notify: Reload consul
tags: configs