dokuwiki: factor out nginx-php role
This commit is contained in:
parent
52f8ed5a2d
commit
04f187a140
4 changed files with 7 additions and 3 deletions
5
roles/nginx-php/handlers/main.yml
Normal file
5
roles/nginx-php/handlers/main.yml
Normal file
|
@ -0,0 +1,5 @@
|
|||
- name: restart php-fpm
|
||||
service:
|
||||
name: 'php-fpm{{ php_version }}'
|
||||
state: restarted
|
||||
when: "'handler' not in ansible_skip_tags"
|
43
roles/nginx-php/tasks/main.yml
Normal file
43
roles/nginx-php/tasks/main.yml
Normal file
|
@ -0,0 +1,43 @@
|
|||
- name: Install packages
|
||||
package:
|
||||
name: acl,php,php-fpm
|
||||
|
||||
- name: Get installed packages
|
||||
package_facts:
|
||||
|
||||
- name: Set PHP version
|
||||
set_fact:
|
||||
php_version: "{{ ansible_facts.packages | select('match', '^php[0-9]+$') | first | replace('php', '') }}"
|
||||
|
||||
- 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
|
Loading…
Add table
Add a link
Reference in a new issue