--- - name: Disable system process become: true ansible.builtin.systemd: name: syncthing@sonny state: stopped enabled: false - name: Create Syncthing directories become: true ansible.builtin.file: path: "{{ item.path }}" owner: "{{ item.owner }}" group: "{{ item.group }}" mode: "0755" state: directory loop: - path: "{{ syncthing_app_dir }}" owner: root group: root - path: "{{ syncthing_app_dir }}/state" owner: sonny group: sonny - path: "{{ syncthing_app_dir }}/nginx.conf.d" owner: sonny group: sonny - name: Remove previous Syncthing configurations become: true ansible.builtin.file: path: /home/sonny/.config/syncthing state: absent - name: Copy docker compose configuration become: true ansible.builtin.template: src: "templates/syncthing/docker-compose.j2" dest: "{{ syncthing_app_dir }}/docker-compose.yml" owner: sonny group: sonny mode: "0755" - name: Copy Syncthing configuration become: true ansible.builtin.template: src: "templates/syncthing/config.j2" dest: "{{ syncthing_app_dir }}/state/config.xml" owner: sonny group: sonny mode: "0755" - name: Copy NGINX configuration become: true ansible.builtin.template: src: "templates/syncthing/nginx.j2" dest: "{{ syncthing_app_dir }}/nginx.conf.d/default.conf" owner: sonny group: sonny mode: "0755" - name: Stop current containers community.docker.docker_compose_v2: project_src: "{{ syncthing_app_dir }}" state: stopped - name: Pull missing image community.docker.docker_compose_v2: project_src: "{{ syncthing_app_dir }}" pull: missing state: stopped - name: Remove dangling containers community.docker.docker_compose_v2: project_src: "{{ syncthing_app_dir }}" remove_orphans: true state: stopped - name: Start container community.docker.docker_compose_v2: project_src: "{{ syncthing_app_dir }}" state: present