--- - name: Check protonmail directory exist ansible.builtin.file: path: protonmail state: directory - name: Copy protonmail conf ansible.builtin.copy: src: . dest: protonmail/ register: protonmail_copy_files_results - name: Copy template conf ansible.builtin.template: src: "{{ item.src }}" dest: "protonmail/{{ item.dest }}" loop: - { src: 'docker-compose.yml', dest: 'docker-compose.yml' } - name: Create protonmail network community.docker.docker_network: name: protonmail state: present become: true - name: Show message if not initialized ansible.builtin.debug: msg: Please run init.sh in protonmail folder and set variable protonmail.initialized to true and restart tasks when: not protonmail.initialized - name: Update and restart container community.docker.docker_compose_v2: project_src: protonmail state: present pull: always recreate: "{{ 'always' if protonmail.initialized and protonmail_copy_files_results.changed else 'auto' }}" become: true