diff --git a/collections/ansible_collections/adhdgirl/minilab/roles/syncthing/files/docker-compose.yaml b/collections/ansible_collections/adhdgirl/minilab/roles/syncthing/files/docker-compose.yaml new file mode 100644 index 0000000..4753516 --- /dev/null +++ b/collections/ansible_collections/adhdgirl/minilab/roles/syncthing/files/docker-compose.yaml @@ -0,0 +1,20 @@ +--- +services: + syncthing: + image: lscr.io/linuxserver/syncthing:latest + container_name: syncthing + hostname: syncthing #optional + environment: + - PUID=1000 + - PGID=10000 + - TZ=America/New_York + volumes: + - /opt/syncthing/config:/config + - /opt/syncthing/data1:/data1 + - /mnt/storage/docker/syncthing/data2:/data2 + ports: + - 8384:8384 + - 22000:22000/tcp + - 22000:22000/udp + - 21027:21027/udp + restart: unless-stopped \ No newline at end of file diff --git a/collections/ansible_collections/adhdgirl/minilab/roles/syncthing/tasks/main.yaml b/collections/ansible_collections/adhdgirl/minilab/roles/syncthing/tasks/main.yaml new file mode 100644 index 0000000..5b94ef5 --- /dev/null +++ b/collections/ansible_collections/adhdgirl/minilab/roles/syncthing/tasks/main.yaml @@ -0,0 +1,59 @@ +--- +- name: Load distro-specific variables + ansible.builtin.include_vars: "{{ item }}" + tags: always + with_first_found: + - files: + - "{{ ansible_facts['distribution'] }}.yaml" + skip: true + +- name: Ensure syncthing is installed on hosts + block: + - name: Ensure presense of folders for processes on the server + tags: packages,docker,syncthing + ansible.builtin.file: + path: "/opt/syncthing/{{ item }}" + state: directory + owner: 1000 + group: 10000 + recurse: true + mode: u=rwx,g=rwx,o=r + loop: + - data1 + - config + - name: Ensure network folder is available + tags: packages,docker,syncthing + ansible.builtin.file: + path: /mnt/storage/docker/syncthing/data2 + state: directory + owner: 1000 + group: 10000 + recurse: true + mode: u=rwx,g=rwx,o=r + - name: Ensure compose file is available on the server + tags: packages,docker,syncthing + ansible.builtin.copy: + src: docker-compose.yaml + dest: "/opt/syncthing/docker-compose.yaml" + owner: 1000 + group: 1000 + mode: u=rw,g=r,o=r + # - name: Ensure environment variables file is available on the server + # tags: packages,docker,syncthing + # ansible.builtin.template: + # src: syncthing.env.j2 + # dest: /opt/syncthing/.env + # owner: 1000 + # group: 1000 + # mode: u=rw,g-rwx,o-rwx + - name: Ensure docker containers are pulled and running + tags: docker,syncthing + community.docker.docker_compose_v2: + project_src: "/opt/syncthing" + pull: policy + + rescue: + - name: Set that this task failed # noqa: var-naming[no-role-prefix] + ansible.builtin.set_fact: + task_failed: true +# code: language=ansible diff --git a/collections/ansible_collections/adhdgirl/minilab/roles/syncthing/vars/main.yaml b/collections/ansible_collections/adhdgirl/minilab/roles/syncthing/vars/main.yaml new file mode 100644 index 0000000..e69de29 diff --git a/minilab.yaml b/minilab.yaml index 973eccd..59403ed 100644 --- a/minilab.yaml +++ b/minilab.yaml @@ -55,14 +55,15 @@ - adhdgirl.minilab.traefik - adhdgirl.minilab.authentik - adhdgirl.minilab.arr - - adhdgirl.minilab.ntfy - - adhdgirl.minilab.cloudflared - - adhdgirl.minilab.termix - - adhdgirl.minilab.immich - - adhdgirl.minilab.readeck - adhdgirl.minilab.calibre - - adhdgirl.minilab.valkey + - adhdgirl.minilab.cloudflared - adhdgirl.minilab.forgejo + - adhdgirl.minilab.immich + - adhdgirl.minilab.ntfy + - adhdgirl.minilab.readeck + - adhdgirl.minilab.syncthing + - adhdgirl.minilab.termix + - adhdgirl.minilab.valkey - name: Configure frigate hosts: curren tags: docker,frigate