29 lines
1.0 KiB
YAML
29 lines
1.0 KiB
YAML
---
|
|
- name: Deploy Syncthing service
|
|
block:
|
|
- name: Set Syncthing directories
|
|
ansible.builtin.set_fact:
|
|
syncthing_service_dir: "{{ ansible_env.HOME }}/services/syncthing"
|
|
syncthing_data_dir: "/mnt/object_storage/services/syncthing"
|
|
|
|
- name: Create Syncthing directory
|
|
ansible.builtin.file:
|
|
path: "{{ syncthing_service_dir }}"
|
|
state: directory
|
|
mode: "0755"
|
|
|
|
- name: Deploy Syncthing docker-compose.yml
|
|
ansible.builtin.template:
|
|
src: docker-compose.yml.j2
|
|
dest: "{{ syncthing_service_dir }}/docker-compose.yml"
|
|
mode: "0644"
|
|
register: syncthing_compose
|
|
|
|
- name: Stop Syncthing service
|
|
ansible.builtin.command: docker compose -f "{{ syncthing_service_dir }}/docker-compose.yml" down --remove-orphans
|
|
when: syncthing_compose.changed
|
|
|
|
- name: Start Syncthing service
|
|
ansible.builtin.command: docker compose -f "{{ syncthing_service_dir }}/docker-compose.yml" up -d
|
|
when: syncthing_compose.changed
|