roles: Add php (for debian)

This commit is contained in:
Geno 2020-09-17 00:16:36 +00:00
parent 1bcada7ffe
commit fcf03aaea7
3 changed files with 49 additions and 0 deletions

View File

@ -0,0 +1,4 @@
---
php_version: "7.3"
php_config: []
php_fpm_env: []

View File

@ -0,0 +1,5 @@
---
- name: restart php-fpm
systemd:
name: "php{{ php_version }}-fpm"
state: restarted

40
roles/php/tasks/main.yml Normal file
View File

@ -0,0 +1,40 @@
---
- name: Install php
notify: restart php-fpm
package:
name:
- php-apcu
- php-bcmath
- php-cgi
- php-cli
- php-curl
- php-dev
- php-fpm
- php-gd
- php-gmp
- php-mbstring
- php-mysql
- php-imagick
- php-intl
- php-redis
- php-pspell
- php-xmlrpc
- php-zip
state: latest
- name: set php config
notify: restart php-fpm
lineinfile:
path: "/etc/php/{{ php_version }}/fpm/php.ini"
regex: "^{{item.key}}\\s+=.*"
line: "{{ item.key }} = {{ item.value }}"
with_items: "{{ php_config }}"
- name: set php-fpm config
notify: restart php-fpm
lineinfile:
path: "/etc/php/{{ php_version }}/fpm/pool.d/www.conf"
regex: '^env\[{{item.key}}\]\s+=.*'
line: "env[{{ item.key }}] = {{ item.value }}"
create: yes
with_items: "{{ php_fpm_env }}"