main.yml 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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: Ensure syncthing is running
  7. service: name=syncthing state=started
  8. - name: Syncthing enabled on all interfaces
  9. shell:
  10. 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"
  11. warn: false
  12. notify: Syncthing restarted
  13. - name: Syncthing TLS enabled
  14. shell:
  15. cmd: 'sed -i -e ''/^ <gui/s/tls="false"/tls="true"/'' /usr/local/etc/syncthing/config.xml'
  16. warn: false
  17. notify: Syncthing restarted
  18. - name: Syncthing password protected user
  19. ansible.builtin.lineinfile:
  20. path: /usr/local/etc/syncthing/config.xml
  21. insertafter: "^ <address>0.0.0.0:8384</address>"
  22. line: " <user>admin</user>"
  23. notify: Syncthing restarted
  24. - name: Syncthing password protected pass
  25. ansible.builtin.lineinfile:
  26. path: /usr/local/etc/syncthing/config.xml
  27. insertafter: "^ <address>0.0.0.0:8384</address>"
  28. line: " <password>{{ syncthing_admin_pass }}</password>"
  29. notify: Syncthing restarted
  30. - name: Syncthing disable fsWatcher
  31. shell:
  32. cmd: 'sed -i -e ''s/fsWatcherEnabled="true"/fsWatcherEnabled="false"/'' /usr/local/etc/syncthing/config.xml'
  33. warn: false
  34. notify: Syncthing restarted