ansible-roles/php/tasks/main_bullseye.yml

103 lines
3 KiB
YAML
Raw Normal View History

2021-05-01 17:51:50 +02:00
---
2023-02-13 10:09:37 +01:00
- name: "Set php version to 7.4 if Sury repo is not enabled"
ansible.builtin.set_fact:
2023-02-13 10:09:37 +01:00
php_version: "7.4"
2023-03-20 23:48:40 +01:00
when: not (php_sury_enable | bool)
check_mode: no
2023-02-13 10:09:37 +01:00
2021-09-29 16:40:25 +02:00
- name: "Set variables (Debian 11)"
ansible.builtin.set_fact:
2023-02-13 10:09:37 +01:00
php_cli_defaults_ini_file: /etc/php/{{ php_version }}/cli/conf.d/z-evolinux-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
2021-05-01 17:51:50 +02:00
# Packages
2021-09-29 16:40:25 +02:00
- name: "Set package list (Debian 11)"
ansible.builtin.set_fact:
2021-05-01 17:51:50 +02:00
php_stretch_packages:
- php-cli
- php-gd
- php-intl
- php-imap
- php-ldap
- php-mysql
- php-pgsql
- php-sqlite3
- php-curl
- php-ssh2
- php-xml
2021-05-01 17:51:50 +02:00
- php-zip
- composer
- libphp-phpmailer
- ansible.builtin.include: sury_pre.yml
2021-05-01 17:51:50 +02:00
when: php_sury_enable
2021-09-29 16:40:25 +02:00
- name: "Install PHP packages (Debian 11)"
ansible.builtin.apt:
2021-05-01 17:51:50 +02:00
name: '{{ php_stretch_packages }}'
state: present
2021-09-29 16:40:25 +02:00
- name: "Install mod_php packages (Debian 11)"
ansible.builtin.apt:
2021-05-01 17:51:50 +02:00
name:
- libapache2-mod-php
- php
state: present
when: php_apache_enable
2021-09-29 16:40:25 +02:00
- name: "Install PHP FPM packages (Debian 11)"
ansible.builtin.apt:
2021-05-01 17:51:50 +02:00
name:
2023-02-13 10:09:37 +01:00
- php{{ php_version }}-fpm
- php{{ php_version }}
2021-05-01 17:51:50 +02:00
state: present
when: php_fpm_enable
# Configuration
2021-09-29 16:40:25 +02:00
- name: "Enforce permissions on PHP directory (Debian 11)"
ansible.builtin.file:
2021-05-01 17:51:50 +02:00
dest: "{{ item }}"
mode: "0755"
with_items:
- /etc/php
2023-02-13 10:09:37 +01:00
- /etc/php/{{ php_version }}
2021-05-01 17:51:50 +02:00
- ansible.builtin.include: config_cli.yml
2021-09-29 16:40:25 +02:00
- name: "Enforce permissions on PHP cli directory (Debian 11)"
ansible.builtin.file:
2023-02-13 10:09:37 +01:00
dest: /etc/php/{{ php_version }}/cli
2021-05-01 17:51:50 +02:00
mode: "0755"
- ansible.builtin.include: config_fpm.yml
2021-05-01 17:51:50 +02:00
when: php_fpm_enable
2021-09-29 16:40:25 +02:00
- name: "Enforce permissions on PHP fpm directory (Debian 11)"
ansible.builtin.file:
2023-02-13 10:09:37 +01:00
dest: /etc/php/{{ php_version }}/fpm
2021-05-01 17:51:50 +02:00
mode: "0755"
when: php_fpm_enable
2021-05-01 17:51:50 +02:00
- ansible.builtin.include: config_apache.yml
2021-05-01 17:51:50 +02:00
when: php_apache_enable
2021-09-29 16:40:25 +02:00
- name: "Enforce permissions on PHP apache2 directory (Debian 11)"
ansible.builtin.file:
2023-02-13 10:09:37 +01:00
dest: /etc/php/{{ php_version }}/apache2
2021-05-01 17:51:50 +02:00
mode: "0755"
when: php_apache_enable
2021-05-01 17:51:50 +02:00
2023-02-13 10:09:37 +01:00
#- include: sury_post.yml
# when: php_sury_enable