summaryrefslogtreecommitdiff
path: root/tasks/main.yaml
diff options
context:
space:
mode:
authorJulien Dessaux2023-01-22 00:16:43 +0100
committerJulien Dessaux2023-01-22 00:20:57 +0100
commit23e2941b3a6aff6415913cc91198147128260b06 (patch)
tree5c9f27dace6a077a447d5f1267de033b454f0f42 /tasks/main.yaml
parentInitial import (diff)
downloadsyncthing-ansible-role-23e2941b3a6aff6415913cc91198147128260b06.tar.gz
syncthing-ansible-role-23e2941b3a6aff6415913cc91198147128260b06.tar.bz2
syncthing-ansible-role-23e2941b3a6aff6415913cc91198147128260b06.zip
Imported from personal ansible repository1.0
Diffstat (limited to '')
-rw-r--r--tasks/main.yaml58
1 files changed, 58 insertions, 0 deletions
diff --git a/tasks/main.yaml b/tasks/main.yaml
new file mode 100644
index 0000000..984a0cd
--- /dev/null
+++ b/tasks/main.yaml
@@ -0,0 +1,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