{"id":22964687,"url":"https://github.com/39services/ansible_role_syncthing","last_synced_at":"2025-04-02T04:21:59.662Z","repository":{"id":62386276,"uuid":"560179873","full_name":"39services/ansible_role_syncthing","owner":"39services","description":"Ansible role to install and configure Syncthing with devices and folders","archived":false,"fork":false,"pushed_at":"2024-06-07T11:28:44.000Z","size":63,"stargazers_count":2,"open_issues_count":1,"forks_count":5,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-28T18:04:45.011Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Jinja","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/39services.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-10-31T22:52:29.000Z","updated_at":"2025-01-21T14:05:45.000Z","dependencies_parsed_at":"2023-01-23T17:46:06.062Z","dependency_job_id":"6bfe23cb-c651-4c8a-94b6-7ac4c95618f4","html_url":"https://github.com/39services/ansible_role_syncthing","commit_stats":null,"previous_names":["x86-39/ansible_role_syncthing","39services/ansible_role_syncthing"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/39services%2Fansible_role_syncthing","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/39services%2Fansible_role_syncthing/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/39services%2Fansible_role_syncthing/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/39services%2Fansible_role_syncthing/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/39services","download_url":"https://codeload.github.com/39services/ansible_role_syncthing/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246753355,"owners_count":20828134,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-14T20:11:57.689Z","updated_at":"2025-04-02T04:21:59.638Z","avatar_url":"https://github.com/39services.png","language":"Jinja","funding_links":[],"categories":[],"sub_categories":[],"readme":"Ansible Role Syncthing\n=========\n\n[![Molecule Test](https://github.com/diademiemi/ansible_role_syncthing/actions/workflows/molecule.yml/badge.svg)](https://github.com/diademiemi/ansible_role_syncthing/actions/workflows/molecule.yml)\n\nThis is an Ansible role that installs Syncthing on Linux. It uses the tarball from the official website so this role is not dependent on any package manager.  \n\nThis role can also optionally configure the devices and folders on the Syncthing instance.  \n\nTested on Fedora 36, should work on any Linux distribution that the Syncthing tarball supports.  \n\nRequirements\n------------\nThese platforms are supported:\n- Ubuntu 20.04\n- Ubuntu 22.04\n- Debian 11\n- Debian 12\n- EL 8 (Tested on Rocky Linux 8)\n- EL 9 (Tested on Rocky Linux 9)\n- Fedora 40\n- openSUSE Leap 15.5\n\nRole Variables\n--------------\n\n| Variable | Default | Description |\n|----------|---------|-------------|\n| `syncthing_version` | `v1.23.4` | Version of Syncthing to install. |\n| `syncthing_arch` | `amd64` | Architecture for the Syncthing package. |\n| `syncthing_url` | See [defaults/main.yml](./defaults/main.yml) | Base URL for the Syncthing tarball. |\n| `syncthing_user` | `{{ ansible_user_id }}` | User to configure Syncthing for. |\n| `syncthing_install_user` | `true` | Whether to configure and enable syncthing to run as this user |\n| `syncthing_device_name` | `{{ inventory_hostname }}` | Name of the Syncthing device to other devices. |\n| `syncthing_hosts` | `{{ ansible_play_hosts_all }}` | List of hosts (including self) to use as Syncthing peers. |\n| `syncthing_configure` | `true` | Whether to configure Syncthing. |\n| `syncthing_configure_firewall` | `true` | Whether to configure firewall rules for Syncthing to work locally. |\n| `syncthing_bootstrap_only` | `false` | Whether to only configure Syncthing once. |\n| `syncthing_gui_enabled` | `true` | Whether to enable the Syncthing GUI. |\n| `syncthing_gui_address` | `127.0.0.1:8384` | Address to bind the Syncthing GUI to. |\n| `syncthing_gui_apikey` | `\"\"` | API key to use for the Syncthing GUI. |\n| `syncthing_gui_theme` | `default` | Theme to use for the Syncthing GUI. |\n\n\nConfiguration\n-------------\n\nThis Ansible role will overwrite your Syncthing configuration, be careful!  \n\nThis role by default will also overwrite any manual changes, if you want to just use this role to install and set up Syncthing one time, and do the rest manually, set `syncthing_bootstrap_only` to true.  \nOtherwise, every time this role is run, it will overwrite configuration that is not stored in the Ansible variables.  \n\n### Devices\nThe `syncthing_devices` variable is used to configure remote devices on the Syncthing instance.  *This variable is not required*, if this variable is not set, this role will generate it based on the other hosts in this play.  \nIf you want to configure devices manually, you can set this variable yourself.\n\n\u003cdetails\u003e \u003csummary\u003e Static list of devices \u003c/summary\u003e\n\n```yaml\nsyncthing_devices: # Static list of devices\n  - name: \"My Laptop\"\n    device_id: \"AAAAAAA-BBBBBBB-CCCCCCC-DDDDDDD-EEEEEEE-FFFFFFF-GGGGGGG-HHHHHHH\"\n    address: dynamic\n  - name: \"My PC\"\n    device_id: \"AAAAAAA-BBBBBBB-CCCCCCC-DDDDDDD-EEEEEEE-FFFFFFF-GGGGGGG-HHHHHHH\"\n    address: dynamic\n```\n\n\u003c/details\u003e\n\nA likely scenario is that you just want to add existing hosts not managed by this Ansible role (like your mobile phone) to this list, in which case you can use the variable `syncthing_external_devices`.  \n```yaml\nsyncthing_external_devices: # Append to auto generated devices\n  - name: \"My Non-Ansible Managed Phone\"\n    device_id: \"AAAAAAA-BBBBBBB-CCCCCCC-DDDDDDD-EEEEEEE-FFFFFFF-GGGGGGG-HHHHHHH\"\n    address: dynamic\n```\n\n### Folders\nThe `syncthing_folders` variable is a dict of dicts. The key is the folder ID, and the value is a dict of folder configuration.  \n\n```yaml\nsyncthing_folders:\n  sync:\n    label: Sync\n    path: \"/home/{{ syncthing_user }}/Sync\"\n```\n\nThe key is used as the folder ID in Syncthing, this must be the same on every device you want using this folder. When this key is set on multiple hosts this folder will be shared across these hosts.  \n\nIf you defined hosts that are not in the Ansible play (with `syncthing_external_devices` or  `syncthing_devices`), you will need to specify that this folder should be shared with those hosts by giving the ID in the list `manual_shared_with`.  \n\n\u003cdetails\u003e \u003csummary\u003e Example for external devices \u003c/summary\u003e\n\n```yaml\nsyncthing_folders:\n  sync:\n    label: Sync\n    path: \"/home/{{ syncthing_user }}/Sync\"\n    manual_shared_with: # Append to auto generated shared devices\n      - \"AAAAAAA-BBBBBBB-CCCCCCC-DDDDDDD-EEEEEEE-FFFFFFF-GGGGGGG-HHHHHHH\"\n```\n\n\u003c/details\u003e\n\nThe folder configuration can include `label`, `path`, `type`, `rescanIntervalS`, `fsWatcherEnabled` , `fsWatcherDelayS`, `ignorePerms` and `autoNormalize`. The `label` and `path` keys are required for each folder.  \n\nYou can set the default configuration for all folders by setting the `syncthing_folders_default` variable. This will also be used in the UI as the defaults for management outside of Ansible.  \n\n\u003cdetails\u003e \u003csummary\u003e Defaults \u003c/summary\u003e\n\n```yaml\nsyncthing_folder_defaults: # Will be used if missing from folder\n  path: \"/home/{{ syncthing_user }}/Sync\"\n  type: sendreceive\n  rescanIntervalS: \"3600\"\n  fsWatcherEnabled: \"true\"\n  fsWatcherDelayS: \"10\"\n  ignorePerms: \"false\"\n  autoNormalize: \"true\"\n```\n\n\u003c/details\u003e\n\n### Example\n\nThe following is an example of a playbook that uses this role.  \n\n\u003cdetails\u003e \u003csummary\u003e \u003ccode\u003e inventory.ini \u003c/code\u003e \u003c/summary\u003e\n\n```ini\n[syncthing]\ndesktop\nlaptop\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e \u003csummary\u003e \u003ccode\u003e group_vars/syncthing.yml \u003c/code\u003e \u003c/summary\u003e\n\n```yaml\nsyncthing_external_devices: # Append to auto generated devices\n  - name: \"My Non-Ansible Managed Phone\"\n    device_id: \"AAAAAAA-BBBBBBB-CCCCCCC-DDDDDDD-EEEEEEE-FFFFFFF-GGGGGGG-HHHHHHH\"\n    address: dynamic\n```\n\nThe device entries for `desktop` and `laptop` will be generated automatically based on the hosts in the play.  \n\n\u003c/details\u003e\n\n\u003cdetails\u003e \u003csummary\u003e \u003ccode\u003e host_vars/desktop.yml \u003c/code\u003e \u003c/summary\u003e\n\n```yaml\nsyncthing_folders:\n  all:\n    label: Shared with all\n    path: /home/{{ syncthing_user }}/Sync\n    manual_shared_with: # Append to auto generated shared devices\n      - \"AAAAAAA-BBBBBBB-CCCCCCC-DDDDDDD-EEEEEEE-FFFFFFF-GGGGGGG-HHHHHHH\"\n  phone:\n    label: Shared with my phone\n    path: /home/{{ syncthing_user }}/Phone\n    manual_shared_with: # Append to auto generated shared devices\n      - \"AAAAAAA-BBBBBBB-CCCCCCC-DDDDDDD-EEEEEEE-FFFFFFF-GGGGGGG-HHHHHHH\"\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e \u003csummary\u003e \u003ccode\u003e host_vars/laptop.yml \u003c/code\u003e \u003c/summary\u003e\n\n```yaml\nsyncthing_folders:\n  all:\n    label: Shared with all\n    path: /home/{{ syncthing_user }}/Sync\n    manual_shared_with: # Append to auto generated shared devices\n      - \"AAAAAAA-BBBBBBB-CCCCCCC-DDDDDDD-EEEEEEE-FFFFFFF-GGGGGGG-HHHHHHH\"\n```\n\nSince the `phone` key doesn't appear here, it won't be shared with this device.  \n\n\u003c/details\u003e\n\n\u003cdetails\u003e \u003csummary\u003e \u003ccode\u003e playbook.yml \u003c/code\u003e \u003c/summary\u003e\n\n```yaml\n- hosts: syncthing\n  roles:\n    - ansible_role_syncthing\n```\n\n\u003c/details\u003e\n\nDependencies\n------------\n\u003c!-- List dependencies on other roles or criteria --\u003e\nNone\n\nExample Playbook\n----------------\n\n```yaml\n- name: Use diademiemi.syncthing role\n  hosts: \"{{ target | default('syncthing') }}\"\n  roles:\n    - role: \"diademiemi.syncthing\"\n      tags: ['diademiemi', 'solaar', 'setup']\n\n```\n\nLicense\n-------\n\nMIT\n\nAuthor Information\n------------------\n\n- diademiemi (@diademiemi)\n\nRole Testing\n------------\n\nThis repository comes with Molecule that run in Podman on the supported platforms.\nInstall Molecule by running\n\n```bash\npip3 install -r requirements.txt\n```\n\nRun the tests with\n\n```bash\nmolecule test\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F39services%2Fansible_role_syncthing","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F39services%2Fansible_role_syncthing","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F39services%2Fansible_role_syncthing/lists"}