cloud-environments-example/roles/php/tasks/main.yml
2023-08-20 11:13:16 +02:00

66 lines
1.9 KiB
YAML
Executable File

---
- name: install requirements for php repository
apt:
update_cache: yes
state: "{% if cloud_update | bool %}latest{% else %}present{% endif %}"
install_recommends: yes
pkg:
- apt-transport-https
- ca-certificates
- gnupg2
- lsb-release
- libmagickcore-6.q16-6-extra # SVG for imagick php module
- name: install PHP sury repository key
apt_key:
url: https://packages.sury.org/php/apt.gpg
state: present
- name: install PHP sury repository
apt_repository:
repo: "deb https://packages.sury.org/php/ {{ ansible_distribution_release }} main"
state: present
- name: install PHP and recommendations
apt:
update_cache: yes
state: "{% if cloud_update | bool %}latest{% else %}present{% endif %}"
install_recommends: yes
pkg: "{{ php_modules + php_modules_base }}"
- name: configure PHP fpm
lineinfile:
path: "{{ php_path }}/fpm/php.ini"
regexp: '^(;|){{ item.key }} = '
line: "{{ item.key }} = {{ item.value }}"
loop: "{{ php_fpm_config + php_fpm_config_default }}"
loop_control:
label: "{{ item.key }}"
notify: restart php-fpm
- name: configure PHP fpm pool conf
lineinfile:
path: "{{ php_path }}/fpm/pool.d/www.conf"
regexp: '^(;|){{ item.key }} = '
line: "{{ item.key }} = {{ item.value }}"
loop: "{{ php_fpm_poolconf + php_fpm_poolconf_default }}"
loop_control:
label: "{{ item.key }}"
notify: restart php-fpm
- name: configure PHP fpm env pool conf
lineinfile:
path: "{{ php_path }}/fpm/pool.d/www.conf"
regexp: '^(;|)env\[{{ item.key }}\] = '
line: "env[{{ item.key }}] = {{ item.value }}"
loop: "{{ php_fpm_poolconf_env }}"
loop_control:
label: "{{ item.key }}"
notify: restart php-fpm
- name: configure PHP apcu availability
lineinfile:
path: "{{ php_path }}/mods-available/apcu.ini"
regexp: '^(;\s*|)apc.enable_cli='
line: "apc.enable_cli=1"
notify: restart php-fpm