Update syncthing setup

This commit is contained in:
sonny 2025-03-12 22:36:46 +01:00
parent dcbdfdc422
commit 734b1a3321
9 changed files with 363 additions and 195 deletions

View file

@ -1,13 +1,66 @@
# TODO: use docker setup
- name: create syncthing directory
file:
path: '{{ ansible_env.HOME }}/.config/syncthing'
mode: '755'
state: directory
- name: Disable system process
become: true
ansible.builtin.systemd:
name: syncthing@sonny
state: stopped
enabled: false
- name: copy syncthing template
template:
src: 'templates/syncthing.j2'
dest: '{{ ansible_env.HOME }}/.config/syncthing/config.xml'
mode: '0600'
notify: restart syncthing service
- 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