2014-08-16 23:35:57 +02:00
|
|
|
---
|
2020-07-14 08:45:33 +02:00
|
|
|
# Ubuntu 20.04 uses PHP 7.4
|
2021-09-06 20:19:57 +02:00
|
|
|
# Debian 11 uses PHP 7.4
|
2014-08-16 23:35:57 +02:00
|
|
|
|
2021-09-08 08:32:06 +02:00
|
|
|
# If any of the vhosts on this host need WordPress then we need to install PHP.
|
|
|
|
# This uses selectattr to filter the list of dicts in nginx_vhosts, selecting
|
2022-09-10 21:33:19 +02:00
|
|
|
# any that have has_wordpress defined, and has_wordpress set to true.
|
2021-09-08 08:32:06 +02:00
|
|
|
#
|
|
|
|
# See: https://stackoverflow.com/a/31896249
|
|
|
|
- name: Check if any vhost needs WordPress
|
2022-09-10 17:09:12 +02:00
|
|
|
ansible.builtin.set_fact:
|
2022-09-10 21:33:19 +02:00
|
|
|
install_php: true
|
|
|
|
when: "nginx_vhosts | selectattr('has_wordpress', 'defined') | selectattr('has_wordpress', 'equalto', true) | list | length > 0"
|
2021-09-08 08:32:06 +02:00
|
|
|
|
|
|
|
# Legacy, was only for Piwik, but leaving for now.
|
|
|
|
- name: Check if any vhost needs PHP
|
2022-09-10 17:09:12 +02:00
|
|
|
ansible.builtin.set_fact:
|
2022-09-10 21:33:19 +02:00
|
|
|
install_php: true
|
|
|
|
when: "nginx_vhosts | selectattr('needs_php', 'defined') | selectattr('needs_php', 'equalto', true) | list | length > 0"
|
2021-09-08 08:32:06 +02:00
|
|
|
|
|
|
|
# If install_php has not been set, then we assume no vhosts need PHP. This is
|
|
|
|
# a bit hacky, but it's the closest we come to an if/then/else.
|
2022-09-10 21:33:19 +02:00
|
|
|
- name: Set install_php to false
|
2022-09-10 17:09:12 +02:00
|
|
|
ansible.builtin.set_fact:
|
2022-09-10 21:33:19 +02:00
|
|
|
install_php: false
|
2021-09-08 08:32:06 +02:00
|
|
|
when: install_php is not defined
|
|
|
|
|
2020-07-13 22:25:32 +02:00
|
|
|
- name: Configure php-fpm on Ubuntu 20.04
|
2022-09-10 17:09:12 +02:00
|
|
|
ansible.builtin.include_tasks: Ubuntu_20.04.yml
|
2022-09-10 22:12:49 +02:00
|
|
|
when:
|
|
|
|
- ansible_distribution == 'Ubuntu'
|
|
|
|
- ansible_distribution_version is version('20.04', '==')
|
|
|
|
- install_php == true
|
2020-07-13 22:25:32 +02:00
|
|
|
tags: php-fpm
|
|
|
|
|
2021-09-06 20:19:57 +02:00
|
|
|
- name: Configure php-fpm on Debian 11
|
2022-09-10 17:09:12 +02:00
|
|
|
ansible.builtin.include_tasks: Ubuntu_20.04.yml
|
2022-09-10 22:12:49 +02:00
|
|
|
when:
|
|
|
|
- ansible_distribution == 'Debian'
|
|
|
|
- ansible_distribution_version is version('11', '==')
|
|
|
|
- install_php == true
|
2021-09-06 20:19:57 +02:00
|
|
|
tags: php-fpm
|
|
|
|
|
2014-08-16 23:35:57 +02:00
|
|
|
# vim: set ts=2 sw=2:
|