blob: 984a0cd87608d4234aefa6da6817e36c359675af (
plain)
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
|
- name: Push syncthing gathering fact on clients
copy:
src: syncthing.fact
dest: /etc/ansible/facts.d/
mode: 0500
owner: root
register: syncthing_gathering_fact
- name: reload ansible_local
setup: filter=ansible_local
when: syncthing_gathering_fact.changed
#- debug:
# msg: "{{ syncthing_config }}"
# changed_when: true
- action: syncthing_validate
- action: syncthing_init
- name: Install syncthing dependencies
package:
name: "{{ syncthing_config.packages }}"
- name: enforces service directories
file:
state: directory
path: "{{ item }}"
owner: syncthing
mode: 0700
loop: "{{ syncthing_config.folders_to_create }}"
- name: enforces config file
template:
src: config.xml
dest: "{{ syncthing_config.config_path }}"
owner: "{{ syncthing_config.user_group }}"
mode: 0640
notify: restart syncthing
- name: start and enables service
service:
name: syncthing
enabled: yes
state: started
- name: reload ansible_local
setup: filter=ansible_local
when: syncthing_gathering_fact.changed
- name: enforces config file
template:
src: config.xml
dest: "{{ syncthing_config.config_path }}"
owner: "{{ syncthing_config.user_group }}"
mode: 0640
when: syncthing_gathering_fact.changed
notify: restart syncthing
|