blob: 3c5ddb21b68fd003a13eb5df21f7da4f8cc1f8a1 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
|
# syncthing ~~ roles/syncthing/tasks/main.yml
# Init syncthing user and settings
---
- name: ensure syncthing package is present
package:
name: syncthing
state: present
- name: ensure syncthing directory exists
file:
path: "{{ syncthing_dir }}"
owner: "{{ syncthing_user }}"
group: "{{ syncthing_group }}"
mode: 0700
state: directory
- name: ensure original syncthing dir does not exist
file:
path: /var/syncthing
state: absent
- name: ensure syncthing directory is redirected
file:
src: "{{ syncthing_dir }}"
dest: /var/syncthing
owner: _syncthing
group: _syncthing
mode: 0700
state: link
- name: ensure syncthing is started once
service:
name: syncthing
state: restarted
- name: wait for generation of config.
pause:
seconds: 2
- name: ensure syncthing is stopped once
service:
name: syncthing
state: stopped
- name: ensure GUI options
community.general.xml:
path: "{{ syncthing_dir }}/.config/syncthing/config.xml"
xpath: "/configuration/gui"
attribute: "{{ item[0] }}"
value: "{{ item[1] }}"
loop:
- [ "enabled", "true" ]
- [ "tls", "true" ]
- name: ensure GUI listen address
community.general.xml:
path: "{{ syncthing_dir }}/.config/syncthing/config.xml"
xpath: "/configuration/gui/address"
value: "{{ syncthing_gui_address }}:{{ syncthing_gui_port }}"
- name: ensure common options
community.general.xml:
path: "{{ syncthing_dir }}/.config/syncthing/config.xml"
xpath: "/configuration/options/{{ item[0] }}"
value: "{{ item[1] }}"
loop:
- [ "globalAnnounceEnabled", "false" ]
- [ "localAnnounceEnabled", "true" ]
- [ "relaysEnabled", "false" ]
- [ "natEnabled", "false" ]
- [ "startBrowser", "false" ]
- name: import openbsd custom rules
include_tasks: _openbsd.yml
when: ansible_distribution == "OpenBSD"
- name: ensure syncthing is started and enabled
service:
name: syncthing
state: restarted
enabled: true
|