--- # alpine - name: "[Alpine] Generate php-fpm listener configs" template: src: php-fpm-listener.conf.j2 dest: /etc/php{{ services.php_fpm.version | default(7) }}/php-fpm.d/{{item.key}}.conf owner: root group: root mode: 0644 loop: "{{ lookup('dict', services.php_fpm.listeners, wantlist=True) }}" register: php_fpm_deployed_configs notify: "Restart php-fpm" when: - ansible_distribution == "Alpine" - services.php_fpm.listeners is defined - name: "[Alpine] Collect files in directory: /etc/php{{ services.php_fpm.version | default(7) }}/php-fpm.d" find: path: "/etc/php{{ services.php_fpm.version | default(7) }}/php-fpm.d" hidden: yes register: php_fpm_found_files check_mode: no changed_when: false when: - ansible_distribution == "Alpine" - services.php_fpm.listeners is defined - name: "[Alpine] Remove unmanaged files in directory: /etc/php{{ services.php_fpm.version | default(7) }}/php-fpm.d" file: path: "/etc/php{{ services.php_fpm.version | default(7) }}/php-fpm.d/{{ item.path | basename }}" state: absent with_items: - "{{ php_fpm_found_files.files }}" notify: "Restart php-fpm" when: - ansible_distribution == "Alpine" - services.php_fpm.listeners is defined - (item.path) not in ( php_fpm_deployed_configs | json_query('results[].invocation.module_args.dest') | default([]) ) # archlinux (php7) - name: "[Archlinux] Generate php7-fpm listener configs" template: src: php-fpm-listener.conf.j2 dest: /etc/php7/php-fpm.d/{{item.key}}.conf owner: root group: root mode: 0644 loop: "{{ lookup('dict', services.php_fpm.listeners, wantlist=True) }}" register: php_fpm_deployed_configs notify: "Restart php-fpm" when: - ansible_distribution == "Archlinux" - services.php_fpm.version is not defined or services.php_fpm.version == 7 - services.php_fpm.listeners is defined - name: "[Archlinux] Collect files in directory: /etc/php7/php-fpm.d" find: path: "/etc/php7/php-fpm.d" hidden: yes register: php_fpm_found_files check_mode: no changed_when: false when: - ansible_distribution == "Alpine" - services.php_fpm.version is not defined or services.php_fpm.version == 7 - services.php_fpm.listeners is defined - name: "[Alpine] Remove unmanaged files in directory: /etc/php7/php-fpm.d" file: path: "/etc/php7/php-fpm.d/{{ item.path | basename }}" state: absent with_items: - "{{ php_fpm_found_files.files }}" notify: "Restart php-fpm" when: - ansible_distribution == "Alpine" - services.php_fpm.version is not defined or services.php_fpm.version == 7 - services.php_fpm.listeners is defined - (item.path) not in ( php_fpm_deployed_configs | json_query('results[].invocation.module_args.dest') | default([]) ) # archlinux (php8) - name: "[Archlinux] Generate php8-fpm listener configs" template: src: php-fpm-listener.conf.j2 dest: /etc/php/php-fpm.d/{{item.key}}.conf owner: root group: root mode: 0644 loop: "{{ lookup('dict', services.php_fpm.listeners, wantlist=True) }}" register: php_fpm_deployed_configs notify: "Restart php-fpm" when: - ansible_distribution == "Archlinux" - services.php_fpm.version == 8 - services.php_fpm.listeners is defined - name: "[Archlinux] Collect files in directory: /etc/php/php-fpm.d" find: path: "/etc/php/php-fpm.d" hidden: yes register: php_fpm_found_files check_mode: no changed_when: false when: - ansible_distribution == "Archlinux" - services.php_fpm.version == 8 - services.php_fpm.listeners is defined - name: "[Alpine] Remove unmanaged files in directory: /etc/php/php-fpm.d" file: path: "/etc/php/php-fpm.d/{{ item.path | basename }}" state: absent with_items: - "{{ php_fpm_found_files.files }}" notify: "Restart php-fpm" when: - ansible_distribution == "Archlinux" - services.php_fpm.version == 8 - services.php_fpm.listeners is defined - (item.path) not in ( php_fpm_deployed_configs | json_query('results[].invocation.module_args.dest') | default([]) )