ansible-roles/php/tasks/main_buster.yml

107 lines
3.1 KiB
YAML
Raw Normal View History

2019-06-26 17:39:22 +02:00
---
- ansible.builtin.debug:
2023-03-19 11:53:14 +01:00
var: php_sury_enable
2023-01-31 17:52:55 +01:00
- name: "Set php version to 7.3 if Sury repo is not enabled"
ansible.builtin.set_fact:
2023-01-31 17:52:55 +01:00
php_version: "7.3"
check_mode: no
2023-03-20 23:48:40 +01:00
when: not (php_sury_enable | bool)
2023-01-31 17:52:55 +01:00
2021-09-29 16:40:25 +02:00
- name: "Set variables (Debian 10)"
ansible.builtin.set_fact:
2023-01-31 17:52:55 +01:00
php_cli_defaults_ini_file: /etc/php/{{ php_version }}/cli/conf.d/zvolinux-defaults.ini
php_cli_custom_ini_file: /etc/php/{{ php_version }}/cli/conf.d/zzz-evolinux-custom.ini
php_apache_defaults_ini_file: /etc/php/{{ php_version }}/apache2/conf.d/z-evolinux-defaults.ini
php_apache_custom_ini_file: /etc/php/{{ php_version }}/apache2/conf.d/zzz-evolinux-custom.ini
php_fpm_defaults_ini_file: /etc/php/{{ php_version }}/fpm/conf.d/z-evolinux-defaults.ini
php_fpm_custom_ini_file: /etc/php/{{ php_version }}/fpm/conf.d/zzz-evolinux-custom.ini
php_fpm_debian_default_pool_file: /etc/php/{{ php_version }}/fpm/pool.d/www.conf
php_fpm_default_pool_file: /etc/php/{{ php_version }}/fpm/pool.d/www-evolinux-defaults.conf
php_fpm_default_pool_custom_file: /etc/php/{{ php_version }}/fpm/pool.d/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
2019-06-26 17:39:22 +02:00
# Packages
2021-09-29 16:40:25 +02:00
- name: "Set package list (Debian 10)"
ansible.builtin.set_fact:
2019-06-26 17:39:22 +02:00
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
2020-06-04 11:39:51 +02:00
- php-sqlite3
2019-06-26 17:39:22 +02:00
- php-gettext
- php-curl
- php-ssh2
- php-zip
- composer
- libphp-phpmailer
- ansible.builtin.include: sury_pre.yml
when: php_sury_enable | bool
2019-06-26 17:39:22 +02:00
2021-09-29 16:40:25 +02:00
- name: "Install PHP packages (Debian 10)"
ansible.builtin.apt:
2019-12-31 15:25:10 +01:00
name: '{{ php_stretch_packages }}'
2019-06-26 17:39:22 +02:00
state: present
2021-09-29 16:40:25 +02:00
- name: "Install mod_php packages (Debian 10)"
ansible.builtin.apt:
2019-12-31 15:25:10 +01:00
name:
- libapache2-mod-php
- php
2019-06-26 17:39:22 +02:00
state: present
when: php_apache_enable | bool
2019-06-26 17:39:22 +02:00
2021-09-29 16:40:25 +02:00
- name: "Install PHP FPM packages (Debian 10)"
ansible.builtin.apt:
2019-12-31 15:25:10 +01:00
name:
2023-01-31 17:52:55 +01:00
- php{{ php_version }}-fpm
- php{{ php_version }}
2019-06-26 17:39:22 +02:00
state: present
when: php_fpm_enable | bool
2019-06-26 17:39:22 +02:00
# Configuration
2021-09-29 16:40:25 +02:00
- name: "Enforce permissions on PHP directory (Debian 10)"
ansible.builtin.file:
2019-06-26 17:39:22 +02:00
dest: "{{ item }}"
mode: "0755"
loop:
2019-06-26 17:39:22 +02:00
- /etc/php
2023-01-31 17:52:55 +01:00
- /etc/php/{{ php_version }}
2019-06-26 17:39:22 +02:00
- ansible.builtin.include: config_cli.yml
2021-09-29 16:40:25 +02:00
- name: "Enforce permissions on PHP cli directory (Debian 10)"
ansible.builtin.file:
2023-01-31 17:52:55 +01:00
dest: /etc/php/{{ php_version }}/cli
2019-06-26 17:39:22 +02:00
mode: "0755"
- ansible.builtin.include: config_fpm.yml
when: php_fpm_enable | bool
2020-06-04 11:39:51 +02:00
2021-09-29 16:40:25 +02:00
- name: "Enforce permissions on PHP fpm directory (Debian 10)"
ansible.builtin.file:
2023-01-31 17:52:55 +01:00
dest: /etc/php/{{ php_version }}/fpm
2019-06-26 17:39:22 +02:00
mode: "0755"
when: php_fpm_enable | bool
2019-06-26 17:39:22 +02:00
- ansible.builtin.include: config_apache.yml
when: php_apache_enable | bool
2020-06-04 11:39:51 +02:00
2021-09-29 16:40:25 +02:00
- name: "Enforce permissions on PHP apache2 directory (Debian 10)"
ansible.builtin.file:
2023-01-31 17:52:55 +01:00
dest: /etc/php/{{ php_version }}/apache2
2019-06-26 17:39:22 +02:00
mode: "0755"
when: php_apache_enable | bool
2019-06-26 17:39:22 +02:00
2023-01-31 17:52:55 +01:00
#- include: sury_post.yml
# when: php_sury_enable | bool