--- - name: "[OpenRC] Enable and stop service: php{{ services.php_fpm.version | default(7) }}-fpm (to deploy config changes)" service: name: php{{ services.php_fpm.version | default(7) }}-fpm enabled: no state: stopped when: - ansible_service_mgr == "openrc" - name: "[systemd] Enable and start service: php-fpm7 (to deploy config changes)" systemd: name: php-fpm7 enabled: no state: stopped when: - ansible_service_mgr == "systemd" - services.php_fpm.version is not defined or services.php_fpm.version == 7 - name: "[systemd] Enable and start service: php-fpm (to deploy config changes)" systemd: name: php-fpm enabled: no state: stopped when: - ansible_service_mgr == "systemd" - services.php_fpm.version == 8 - name: "[Alpine] Remove extra PHP{{ services.php_fpm.version | default(7) }} modules" apk: name: "php{{ services.php_fpm.version | default(7) }}-{{ item }}" state: absent loop: "{{ query('list', services.php_fpm.extraModules)[0] }}" when: - ansible_distribution == "Alpine" - name: "[Archlinux] Remove extra PHP7 modules" pacman: name: "php7-{{ item }}" state: absent loop: "{{ query('list', services.php_fpm.extraModules)[0] }}" when: - ansible_distribution == "Archlinux" - services.php_fpm.version is not defined or services.php_fpm.version == 7 - name: "[Archlinux] Remove extra PHP8 modules" pacman: name: "php-{{ item }}" state: absent loop: "{{ query('list', services.php_fpm.extraModules)[0] }}" when: - ansible_distribution == "Archlinux" - services.php_fpm.version == 8 - name: "[Alpine] Remove package: php7 php7-fpm" apk: name: "php7 php7-fpm" state: ansent when: - ansible_distribution == "Alpine" - services.php_fpm.version is not defined or services.php_fpm.version == 7 - name: "[Alpine] Remove package: php8 php8-fpm" apk: name: "php8 php8-fpm" state: ansent when: - ansible_distribution == "Alpine" - services.php_fpm.version == 8 - name: "[Archlinux] Remove package: php7 php7-fpm" pacman: name: - "php7" - "php7-fpm" state: absent when: - ansible_distribution == "Archlinux" - services.php_fpm.version is not defined or services.php_fpm.version == 7 - name: "[Archlinux] Remove package: php php-fpm" pacman: name: - "php" - "php-fpm" state: absent when: - ansible_distribution == "Archlinux" - services.php_fpm.version == 8 - name: "Delete leftovers" file: path: "{{ item }}" state: absent with_items: - /etc/php - /etc/php7 - /etc/php8