88 lines
2.7 KiB
YAML
88 lines
2.7 KiB
YAML
---
|
|
# tasks file for syncthing
|
|
|
|
- name: install syncthing
|
|
package:
|
|
state: present
|
|
name: syncthing # not required. Name or list of names of the packages to install, upgrade, or remove.
|
|
become: yes
|
|
|
|
- debug:
|
|
msg: "{{ user }}"
|
|
|
|
- name: start and enable syncthing
|
|
systemd:
|
|
name: syncthing@{{ user.name }} # required. Name of the service.
|
|
enabled: true # not required. Whether the service should start on boot. B(At least one of state and enabled are required.)
|
|
state: started
|
|
become: yes
|
|
|
|
- name: waiting for configfile (takes some time)
|
|
wait_for: path={{ syncthing_home }}/.config/syncthing/config.xml
|
|
|
|
|
|
- name: syncthing | config.xml set webinterface address
|
|
xml:
|
|
file={{ syncthing_home }}/.config/syncthing/config.xml
|
|
xpath=/configuration/gui/address
|
|
value={{ syncthing_address }}
|
|
notify: restart syncthing
|
|
become_user: "{{ user.name }}"
|
|
|
|
- name: syncthing | config.xml set listen address
|
|
xml:
|
|
file={{ syncthing_home }}/.config/syncthing/config.xml
|
|
xpath=/configuration/options/listenAddress
|
|
value={{ syncthing_listen }}
|
|
notify: restart syncthing
|
|
become_user: "{{ user.name }}"
|
|
|
|
- name: syncthing | config.xml set localAnnounceEnabled
|
|
xml:
|
|
file={{ syncthing_home }}/.config/syncthing/config.xml
|
|
xpath=/configuration/options/localAnnounceEnabled
|
|
value={{ syncthing_localannounce|lower }}
|
|
notify: restart syncthing
|
|
become_user: "{{ user.name }}"
|
|
|
|
- name: syncthing | config.xml set globalAnnounceEnabled
|
|
xml:
|
|
file={{ syncthing_home }}/.config/syncthing/config.xml
|
|
xpath=/configuration/options/globalAnnounceEnabled
|
|
value={{ syncthing_globalannounce|lower }}
|
|
notify: restart syncthing
|
|
become_user: "{{ user.name }}"
|
|
|
|
- name: syncthing | config.xml set upnpEnabled
|
|
xml:
|
|
file={{ syncthing_home }}/.config/syncthing/config.xml
|
|
xpath=/configuration/options/upnpEnabled
|
|
value={{ syncthing_upnp|lower }}
|
|
notify: restart syncthing
|
|
become_user: "{{ user.name }}"
|
|
|
|
- name: syncthing | config.xml set user
|
|
xml:
|
|
file={{ syncthing_home }}/.config/syncthing/config.xml
|
|
xpath=/configuration/gui/user
|
|
value={{ syncthing_gui_user }}
|
|
when: syncthing_gui_user is defined
|
|
notify: restart syncthing
|
|
become_user: "{{ user.name }}"
|
|
|
|
- name: syncthing | config.xml set password
|
|
xml:
|
|
file={{ syncthing_home }}/.config/syncthing/config.xml
|
|
xpath=/configuration/gui/password
|
|
value={{ syncthing_gui_password }}
|
|
when: syncthing_gui_password is defined
|
|
notify: restart syncthing
|
|
become_user: "{{ user.name }}"
|
|
|
|
- name: syncthing | config.xml set dark theme
|
|
xml:
|
|
file={{ syncthing_home }}/.config/syncthing/config.xml
|
|
xpath=/configuration/gui/theme
|
|
value=dark
|
|
notify: restart syncthing
|
|
become_user: "{{ user.name }}" |