add syncthing support

This commit is contained in:
Pig Monkey 2018-04-13 21:42:16 -07:00
parent e41c373e19
commit d8d5a799c0
3 changed files with 35 additions and 0 deletions

View file

@ -242,3 +242,6 @@ aur_fonts:
- ttf-caladea
- ttf-courier-prime
- ttf-heuristica
syncthing:
run_on: trusted

View file

@ -72,6 +72,7 @@
- { role: hostsctl, tags: ['hostsctl'], when: "hostsctl is defined" }
- { role: himawaripy, tags: ['himawaripy'], when: "himawaripy is defined" }
- { role: kiwix, tags: ['kiwix'] }
- { role: syncthing, tags: ['syncthing'], when: "syncthing is defined" }
vars_prompt:
- name: user_password
prompt: "Enter desired user password"

View file

@ -0,0 +1,31 @@
---
- name: Install syncthing
pacman: name=syncthing state=present
- name: Enable and start syncthing service
systemd: name=syncthing.service user=yes enabled=yes state=started
become: yes
become_user: "{{ user.name }}"
environment:
XDG_RUNTIME_DIR: "/run/user/{{ user.uid }}"
when: syncthing.run_on == "all"
- name: Remove syncthing from trusted unit list
lineinfile: dest=/usr/local/etc/trusted_units
state=absent
line="syncthing.service,user:{{ user.name }}"
when: syncthing.run_on == "all"
- name: Disable syncthing service
systemd: name=syncthing.service user=yes enabled=no
become: yes
become_user: "{{ user.name }}"
environment:
XDG_RUNTIME_DIR: "/run/user/{{ user.uid }}"
when: syncthing.run_on == "trusted"
- name: Add syncthing to trusted unit list
lineinfile: dest=/usr/local/etc/trusted_units
state=present
line="syncthing.service,user:{{ user.name }}"
when: syncthing.run_on == "trusted"