ansible-roles/php/tasks/main_bookworm.yml
Mathieu Trossevin 7c632352a0
Replace the include module with include_tasks or import_tasks
The behaviour of the `include` module is badly defined (it try to choose
between statically importing the tasks and dynamically including them)
and can cause problems depending on any number of constraints (mostly if
it choose the wrong behaviour).

Replace it with the `import_tasks` (always statically import tasks) unless
the `include` is in a loop in which case we replace it with
`include_tasks` (always dynamically include tasks).
2023-01-03 14:43:42 +01:00

109 lines
2.9 KiB
YAML

---
- name: "Set php version to 8.1 (Debian 12)"
set_fact:
php_version: "8.1"
- name: "Set php config directories (Debian 12)"
set_fact:
php_cli_conf_dir: "/etc/php/{{ php_version }}/cli/conf.d"
php_apache_conf_dir: "/etc/php/{{ php_version }}/apache2/conf.d"
php_fpm_conf_dir: "/etc/php/{{ php_version }}/fpm/conf.d"
php_fpm_pool_dir: "/etc/php/{{ php_version }}/fpm/pool.d"
- name: "Set php config files (Debian 12)"
set_fact:
php_cli_defaults_ini_file: "{{ php_cli_conf_dir }}/z-evolinux-defaults.ini"
php_cli_custom_ini_file: "{{ php_cli_conf_dir }}/zzz-evolinux-custom.ini"
php_apache_defaults_ini_file: "{{ php_apache_conf_dir }}/z-evolinux-defaults.ini"
php_apache_custom_ini_file: "{{ php_apache_conf_dir }}/zzz-evolinux-custom.ini"
php_fpm_defaults_ini_file: "{{ php_fpm_conf_dir }}/z-evolinux-defaults.ini"
php_fpm_custom_ini_file: "{{ php_fpm_conf_dir }}/zzz-evolinux-custom.ini"
php_fpm_debian_default_pool_file: "{{ php_fpm_pool_dir }}/www.conf"
php_fpm_default_pool_file: "{{ php_fpm_pool_dir }}/www-evolinux-defaults.conf"
php_fpm_default_pool_custom_file: "{{ php_fpm_pool_dir }}/www-evolinux-zcustom.conf"
php_fpm_default_pool_socket: "/var/run/php/php{{ php_version }}-fpm.sock"
php_fpm_service_name: "php{{ php_version }}-fpm"
# Packages
- name: "Set package list (Debian 12)"
set_fact:
php_stretch_packages:
- php-cli
- php-gd
- php-intl
- php-imap
- php-ldap
- php-mysql
# php-mcrypt is no longer packaged for PHP 7.2
- php-pgsql
- php-sqlite3
- php-curl
- php-ssh2
- php-xml
- php-zip
- composer
- libphp-phpmailer
- import_tasks: sury_pre.yml
when: php_sury_enable
- name: "Install PHP packages (Debian 12)"
apt:
name: '{{ php_stretch_packages }}'
state: present
- name: "Install mod_php packages (Debian 12)"
apt:
name:
- libapache2-mod-php
- php
state: present
when: php_apache_enable
- name: "Install PHP FPM packages (Debian 12)"
apt:
name:
- php-fpm
- php
state: present
when: php_fpm_enable
# Configuration
- name: "Enforce permissions on PHP directory (Debian 12)"
file:
dest: "{{ item }}"
mode: "0755"
with_items:
- /etc/php
- /etc/php/{{ php_version }}
- import_tasks: config_cli.yml
- name: "Enforce permissions on PHP cli directory (Debian 12)"
file:
dest: /etc/php/{{ php_version }}/cli
mode: "0755"
- import_tasks: config_fpm.yml
when: php_fpm_enable
- name: "Enforce permissions on PHP fpm directory (Debian 12)"
file:
dest: /etc/php/{{ php_version }}/fpm
mode: "0755"
when: php_fpm_enable
- import_tasks: config_apache.yml
when: php_apache_enable
- name: "Enforce permissions on PHP apache2 directory (Debian 12)"
file:
dest: /etc/php/{{ php_version }}/apache2
mode: "0755"
when: php_apache_enable
- import_tasks: sury_post.yml
when: php_sury_enable