diff --git a/docs/applications/syncthing.md b/docs/applications/syncthing.md new file mode 100644 index 00000000..51dba03a --- /dev/null +++ b/docs/applications/syncthing.md @@ -0,0 +1,35 @@ +# Syncthing: Open Source Continuous File Synchronisation + +Homepage: [https://syncthing.net/](https://syncthing.net/) +Github: [https://github.com/syncthing/syncthing](https://github.com/syncthing/syncthing) +Docker: [https://hub.docker.com/r/syncthing/syncthing](https://hub.docker.com/r/syncthing/syncthing) + +Syncthing is a continuous file synchronization program. It synchronizes files +between two or more computers. It strives to fulfill the goals below in summary. +Syncthing should be: + +1. Safe From Data Loss +2. Secure Against Attackers +3. Easy to Use +4. Automatic +5. Universally Available +6. For Individuals +7. For eveything else see the goals document + +## Usage + +Set `syncthing_enabled: true` in your `group_vars/all.yml` file. + +## Specific Configuration + +Open the web interface at :8384 to configure. + +The tasks/syncthing.yml sets +```yaml + env: + STGUIADDRESS: "" +``` +which disables admin GUI access from anywhere except localhost. You can either +remove this (at which point it is visible to your whole network), or use +Traefik. In either case you should consider setting an admin password in the +syncthing GUI. diff --git a/docs/configuration/application_ports.md b/docs/configuration/application_ports.md index 73aff9d0..c06d693a 100644 --- a/docs/configuration/application_ports.md +++ b/docs/configuration/application_ports.md @@ -55,6 +55,8 @@ By default, applications can be found on the ports listed below. | Radarr | 7878 | | | Sickchill | 8081 | | | Sonarr | 8989 | | +| Syncthing admin | 8384 | HTTP | +| Syncthing P2P | 22000 | | | Tautulli | 8185 | | | The Lounge | 9000 | | | Time Machine | 10445 | SMB | diff --git a/nas.yml b/nas.yml index ebcf2c92..d28ac26c 100644 --- a/nas.yml +++ b/nas.yml @@ -148,6 +148,11 @@ - sonarr when: (sonarr_enabled | default(False)) + - role: syncthing + tags: + - syncthing + when: (syncthing_enabled | default(False)) + - role: transmission tags: - transmission diff --git a/roles/syncthing/defaults/main.yml b/roles/syncthing/defaults/main.yml new file mode 100644 index 00000000..56bfacb1 --- /dev/null +++ b/roles/syncthing/defaults/main.yml @@ -0,0 +1,17 @@ +--- +syncthing_enabled: false +syncthing_available_externally: "false" + +# directories +syncthing_data_directory: "{{ samba_shares_root }}/syncthing" + +# these are the directories that you want to mount from the local ansible-nas filesystem into +# the syncthing container. +# format is: +# - "/ansible/nas/filesystem/directory_name:/var/syncthing/directory_name" +syncthing_volumes: + - "{{ syncthing_data_directory }}:/var/syncthing/" + +# network +syncthing_port: 8384 +syncthing_hostname: syncthing \ No newline at end of file diff --git a/roles/syncthing/tasks/main.yml b/roles/syncthing/tasks/main.yml new file mode 100644 index 00000000..cfe75a3c --- /dev/null +++ b/roles/syncthing/tasks/main.yml @@ -0,0 +1,23 @@ +--- +- name: Create Syncthing Directories + file: + path: "{{ item }}" + state: directory + with_items: + - "{{ syncthing_data_directory }}" + +- name: Syncthing Docker Container + docker_container: + name: syncthing + image: syncthing/syncthing:latest + pull: true + network_mode: host + volumes: "{{ syncthing_volumes }}" + restart_policy: unless-stopped + labels: + traefik.enable: "{{ syncthing_available_externally }}" + 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" \ No newline at end of file