- name: set attributes on homes directories file: path: '{{ item.home }}' owner: '{{ item.user }}' group: www-data mode: 0750 state: directory with_items: '{{ phpfpm_pools }}' tags: phpfpm - name: check if pools log files exist stat: path: '{{ phpfpm_dir_log }}/{{ item[0].name }}.{{ item[1] }}' with_nested: - '{{ phpfpm_pools }}' - ['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 with_items: '{{ 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