debian-setup/tasks/syncthing.yml
2025-03-12 22:36:46 +01:00

66 lines
1.6 KiB
YAML

- 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: '{{ ansible_env.HOME }}/.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: Start container
community.docker.docker_compose_v2:
project_src: '{{ syncthing_app_dir }}'
remove_orphans: true
state: restarted
pull: always
wait: true