--- - name: Build pihole compose dirs ansible.builtin.file: state: directory dest: '{{ pihole_base }}/{{ item.path }}' with_filetree: '../templates' when: item.state == 'directory' - name: Build pihole compose files ansible.builtin.template: src: '{{ item.src }}' dest: '{{ pihole_base }}/{{ item.path }}' with_filetree: '../templates' when: item.state == 'file' - name: Deploy Pihole stack ansible.builtin.command: cmd: "docker stack deploy -c {{ pihole_base }}/stacks/docker-compose.yml pihole"