From c986c82aa3b8b7c6c2ddf271873f56502f7d6ff5 Mon Sep 17 00:00:00 2001 From: Phil Date: Thu, 26 Dec 2024 18:28:37 -0700 Subject: [PATCH] add syncthing to stack --- roles/docker/tasks/main.yml | 6 ++++- roles/docker/tasks/syncthing.yml | 19 ++++++++++++++ .../docker/templates/syncthing-compose.yml.j2 | 25 +++++++++++++++++++ 3 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 roles/docker/tasks/syncthing.yml create mode 100644 roles/docker/templates/syncthing-compose.yml.j2 diff --git a/roles/docker/tasks/main.yml b/roles/docker/tasks/main.yml index 4a75775..3da6870 100644 --- a/roles/docker/tasks/main.yml +++ b/roles/docker/tasks/main.yml @@ -132,4 +132,8 @@ - name: Install baikal import_tasks: baikal.yml - tags: baikal \ No newline at end of file + tags: baikal + +- name: Install syncthing + import_tasks: syncthing.yml + tags: syncthing \ No newline at end of file diff --git a/roles/docker/tasks/syncthing.yml b/roles/docker/tasks/syncthing.yml new file mode 100644 index 0000000..0afc6eb --- /dev/null +++ b/roles/docker/tasks/syncthing.yml @@ -0,0 +1,19 @@ +- name: make syncthing directories + ansible.builtin.file: + path: "{{ item}}" + state: directory + loop: + - /opt/stacks/syncthing + +- name: Template out the compose file + ansible.builtin.template: + src: syncthing-compose.yml.j2 + dest: /opt/stacks/syncthing/compose.yml + owner: root + mode: 644 + +- name: deploy syncthing stack + community.docker.docker_compose_v2: + project_src: /opt/stacks/syncthing + files: + - compose.yml \ No newline at end of file diff --git a/roles/docker/templates/syncthing-compose.yml.j2 b/roles/docker/templates/syncthing-compose.yml.j2 new file mode 100644 index 0000000..20cff80 --- /dev/null +++ b/roles/docker/templates/syncthing-compose.yml.j2 @@ -0,0 +1,25 @@ +services: + syncthing: + image: syncthing/syncthing + container_name: syncthing + hostname: my-syncthing + environment: + - PUID=1000 + - PGID=1000 + volumes: + - home:/var/syncthing + ports: + - 100.70.169.99:8384:8384 # Web UI + - 100.70.169.99:22000:22000/tcp # TCP file transfers + - 100.70.169.99:22000:22000/udp # QUIC file transfers + - 100.70.169.99:21027:21027/udp # Receive local discovery broadcasts + restart: unless-stopped + healthcheck: + test: curl -fkLsS -m 2 127.0.0.1:8384/rest/noauth/health | grep -o --color=never OK || exit 1 + interval: 1m + timeout: 10s + retries: 3 + +volumes: + home: +