--- - name: Create Traefik directory file: path: "{{ traefik_folder_name }}" state: directory owner: "{{ base_user_name }}" group: "{{ base_user_name }}" mode: 0755 - name: Create certs directory file: path: "{{ traefik_certs_directory }}" state: directory owner: "root" group: "root" mode: 0600 - name: Create certs file file: path: "{{ traefik_certs_directory }}/acme.json" state: touch modification_time: preserve access_time: preserve owner: "root" group: "root" mode: 0600 - name: Copy Traefik files template: src: "{{ item }}" # Remove .j2 extension dest: "{{ traefik_folder_name }}/{{ (item | splitext)[0] }}" owner: "{{ base_user_name }}" group: "{{ base_user_name }}" mode: 0644 loop: - docker-compose.yml.j2 - traefik.toml.j2 - traefik_dynamic.toml.j2 - name: Ensure container is up to date community.docker.docker_compose: project_src: "{{ traefik_folder_name }}" remove_orphans: yes pull: yes recreate: smart state: present