main.yml 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. ---
  2. - name: Fetched syncthing release
  3. shell:
  4. chdir: /tmp
  5. cmd: fetch https://github.com/syncthing/syncthing/releases/download/v1.19.2/syncthing-freebsd-amd64-v1.19.2.tar.gz
  6. - name: Unpacked syncthing release
  7. shell:
  8. chdir: /tmp
  9. cmd: tar zxf syncthing-freebsd-amd64-v1.19.2.tar.gz
  10. - name: Syncthing installed
  11. shell:
  12. chdir: /tmp/syncthing-freebsd-amd64-v1.19.2
  13. cmd: "mv syncthing /usr/local/bin/syncthing & mv etc/freebsd-rc/syncthing /usr/local/etc/rc.d/syncthing & chmod +x /usr/local/etc/rc.d/syncthing"
  14. warn: false
  15. - name: Syncthing enabled
  16. shell: sysrc syncthing_enable="YES"
  17. - name: Syncthing group set to wheel
  18. shell: sysrc syncthing_group="wheel"
  19. - name: Ensure syncthing is running
  20. service: name=syncthing state=started
  21. - name: Syncthing enabled on all interfaces
  22. shell:
  23. cmd: "sed -i -e '/^ <address>127.0.0.1:8384/s/127.0.0.1/0.0.0.0/' /usr/local/etc/syncthing/config.xml"
  24. warn: false
  25. notify: Syncthing restarted
  26. - name: Syncthing TLS enabled
  27. shell:
  28. cmd: 'sed -i -e ''/^ <gui/s/tls="false"/tls="true"/'' /usr/local/etc/syncthing/config.xml'
  29. warn: false
  30. notify: Syncthing restarted
  31. - name: Syncthing password protected user
  32. ansible.builtin.lineinfile:
  33. path: /usr/local/etc/syncthing/config.xml
  34. insertafter: "^ <address>0.0.0.0:8384</address>"
  35. line: " <user>admin</user>"
  36. notify: Syncthing restarted
  37. - name: Syncthing password protected pass
  38. ansible.builtin.lineinfile:
  39. path: /usr/local/etc/syncthing/config.xml
  40. insertafter: "^ <address>0.0.0.0:8384</address>"
  41. line: " <password>{{ syncthing_admin_pass }}</password>"
  42. notify: Syncthing restarted
  43. - name: Syncthing disable fsWatcher
  44. shell:
  45. cmd: 'sed -i -e ''s/fsWatcherEnabled="true"/fsWatcherEnabled="false"/'' /usr/local/etc/syncthing/config.xml'
  46. warn: false
  47. notify: Syncthing restarted
  48. - name: Ensure syncthing is restarted
  49. service: name=syncthing state=restarted