mirror of
https://github.com/davestephens/ansible-nas
synced 2025-01-13 12:08:53 +00:00
42 lines
1.6 KiB
YAML
42 lines
1.6 KiB
YAML
---
|
|
- name: Start Syncthing
|
|
block:
|
|
- name: Create Syncthing Directories
|
|
ansible.builtin.file:
|
|
path: "{{ item }}"
|
|
state: directory
|
|
with_items:
|
|
- "{{ syncthing_data_directory }}"
|
|
|
|
- name: Syncthing Docker Container
|
|
community.docker.docker_container:
|
|
container_default_behavior: no_defaults
|
|
name: "{{ syncthing_container_name }}"
|
|
image: "{{ syncthing_image_name }}:{{ syncthing_image_version }}"
|
|
pull: true
|
|
ports:
|
|
- "{{ syncthing_port }}:8384"
|
|
- "22000:22000/tcp"
|
|
- "22000:22000/udp"
|
|
env:
|
|
PUID: "{{ syncthing_user_id }}"
|
|
PGID: "{{ syncthing_group_id }}"
|
|
volumes: "{{ syncthing_volumes }}"
|
|
restart_policy: unless-stopped
|
|
memory: "{{ syncthing_memory }}"
|
|
labels:
|
|
traefik.enable: "{{ syncthing_available_externally | string }}"
|
|
traefik.http.routers.syncthing.rule: "Host(`{{ syncthing_hostname }}.{{ ansible_nas_domain }}`)"
|
|
traefik.http.routers.syncthing.tls.certresolver: "letsencrypt"
|
|
traefik.http.routers.syncthing.tls.domains[0].main: "{{ ansible_nas_domain }}"
|
|
traefik.http.routers.syncthing.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
|
|
traefik.http.services.syncthing.loadbalancer.server.port: "8384"
|
|
when: syncthing_enabled is true
|
|
|
|
- name: Stop Syncthing
|
|
block:
|
|
- name: Stop Syncthing
|
|
community.docker.docker_container:
|
|
name: "{{ syncthing_container_name }}"
|
|
state: absent
|
|
when: syncthing_enabled is false
|