main.yml 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. ---
  2. - name: Dependencies installed
  3. community.general.pkgng: name=syncthing state=latest
  4. - name: Syncthing enabled
  5. shell: sysrc syncthing_enable="YES"
  6. - name: Syncthing group set to wheel
  7. shell: sysrc syncthing_group="wheel"
  8. - name: Ensure syncthing is running
  9. service: name=syncthing state=started
  10. - name: Syncthing enabled on all interfaces
  11. shell:
  12. 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"
  13. warn: false
  14. notify: Syncthing restarted
  15. - name: Syncthing TLS enabled
  16. shell:
  17. cmd: 'sed -i -e ''/^ <gui/s/tls="false"/tls="true"/'' /usr/local/etc/syncthing/config.xml'
  18. warn: false
  19. notify: Syncthing restarted
  20. - name: Syncthing password protected user
  21. ansible.builtin.lineinfile:
  22. path: /usr/local/etc/syncthing/config.xml
  23. insertafter: "^ <address>0.0.0.0:8384</address>"
  24. line: " <user>admin</user>"
  25. notify: Syncthing restarted
  26. - name: Syncthing password protected pass
  27. ansible.builtin.lineinfile:
  28. path: /usr/local/etc/syncthing/config.xml
  29. insertafter: "^ <address>0.0.0.0:8384</address>"
  30. line: " <password>{{ syncthing_admin_pass }}</password>"
  31. notify: Syncthing restarted
  32. - name: Syncthing disable fsWatcher
  33. shell:
  34. cmd: 'sed -i -e ''s/fsWatcherEnabled="true"/fsWatcherEnabled="false"/'' /usr/local/etc/syncthing/config.xml'
  35. warn: false
  36. notify: Syncthing restarted