--- - hosts: teier.eu gather_facts: no tasks: - name: Check dc directory stat: path: /dc/pihole register: pihole_dc_dir_stat - name: Create pihole dc directory file: path: /dc/pihole state: directory mode: 0755 group: root owner: root when: pihole_dc_dir_stat.islnk is not defined - name: Copy compose file copy: src: docker-compose.yml dest: /dc/pihole - name: Start pihole shell: "cd /dc/pihole && docker-compose up -d" environment: PIHOLE_PASSWORD: "{{ lookup('env', 'PIHOLE_PASSWORD') }}"