2024-01-20 17:38:41 +00:00
|
|
|
- name: Install packages
|
|
|
|
package:
|
|
|
|
name: acl,php,php-fpm
|
|
|
|
|
2024-05-28 10:54:50 +00:00
|
|
|
- name: Get installed packages
|
|
|
|
package_facts:
|
2024-01-20 17:38:41 +00:00
|
|
|
|
|
|
|
- name: Set PHP version
|
|
|
|
set_fact:
|
2024-05-28 10:54:50 +00:00
|
|
|
php_version: "{{ ansible_facts.packages | select('match', '^php[0-9]+$') | first | replace('php', '') }}"
|
2024-01-20 17:38:41 +00:00
|
|
|
|
|
|
|
- name: Set PHP-FPM settings
|
|
|
|
lineinfile:
|
|
|
|
path: '/etc/php{{ php_version }}/php-fpm.d/www.conf'
|
|
|
|
regexp: '^;?{{ item.key }}\s*='
|
|
|
|
line: '{{ item.key }} = {{ item.value }}'
|
|
|
|
loop:
|
|
|
|
- key: user
|
|
|
|
value: nginx
|
|
|
|
- key: group
|
|
|
|
value: nginx
|
|
|
|
- key: listen
|
|
|
|
value: '/run/php-fpm.socket'
|
|
|
|
- key: listen.acl_users
|
|
|
|
value: nginx
|
|
|
|
- key: listen.acl_groups
|
|
|
|
value: nginx
|
|
|
|
|
|
|
|
- name: Set PHP settings
|
|
|
|
lineinfile:
|
|
|
|
path: '/etc/php{{ php_version }}/php.ini'
|
|
|
|
regexp: '^{{ item.key }}\s*='
|
|
|
|
line: '{{ item.key }} = {{ item.value }}'
|
|
|
|
loop:
|
|
|
|
- key: upload_max_filesize
|
|
|
|
value: 200M
|
|
|
|
notify: restart php-fpm
|
|
|
|
|
|
|
|
- name: Enable php-fpm service
|
|
|
|
service:
|
|
|
|
name: 'php-fpm{{ php_version }}'
|
|
|
|
enabled: true
|
|
|
|
state: started
|