--- - name: check if pools log files exist stat: path: '{{ phpfpm_dir_log }}/{{ item[0].name }}.{{ item[1] }}' loop: '{{ phpfpm_pools|product(log_files)|list }}' vars: log_files: - slow.log - access.log - log register: st tags: phpfpm - name: create log files file: path: '{{ phpfpm_dir_log }}/{{ item.item[0].name }}.{{ item.item[1] }}' owner: root group: www-data mode: 0640 state: touch loop: '{{ st.results }}' when: not item.stat.exists tags: phpfpm - name: copy pools php-fpm configuration file template: src: pools.conf.j2 dest: '{{ phpfpm_dir }}/pools.conf' owner: root group: root mode: 0644 notify: reload php-fpm tags: phpfpm