diff options
author | Julien Dessaux | 2023-01-23 17:33:53 +0100 |
---|---|---|
committer | Julien Dessaux | 2023-01-23 23:12:56 +0100 |
commit | b6ee8f76c2883a934bcf412722e0cf83830173c9 (patch) | |
tree | 97d33cb1f4ea74e0b277a4ed6890b35bc022816e /tasks/main.yaml | |
parent | Imported from personal ansible repository (diff) | |
download | syncthing-ansible-role-b6ee8f76c2883a934bcf412722e0cf83830173c9.tar.gz syncthing-ansible-role-b6ee8f76c2883a934bcf412722e0cf83830173c9.tar.bz2 syncthing-ansible-role-b6ee8f76c2883a934bcf412722e0cf83830173c9.zip |
Simplify fact gathering by using the cli instead of a webapi request1.1
Diffstat (limited to 'tasks/main.yaml')
-rw-r--r-- | tasks/main.yaml | 55 |
1 files changed, 21 insertions, 34 deletions
diff --git a/tasks/main.yaml b/tasks/main.yaml index 984a0cd..218feb3 100644 --- a/tasks/main.yaml +++ b/tasks/main.yaml @@ -1,5 +1,21 @@ +- action: syncthing_pre + +- name: enforces service directories + file: + state: directory + path: "{{ item }}" + owner: "{{ syncthing_pre.user_group }}" + mode: 0700 + loop: + - "{{ syncthing_pre.config_dir }}" + - "{{ syncthing_pre.data_dir }}" + +- name: Install syncthing dependencies + package: + name: "{{ syncthing_pre.packages }}" + - name: Push syncthing gathering fact on clients - copy: + template: src: syncthing.fact dest: /etc/ansible/facts.d/ mode: 0500 @@ -10,49 +26,20 @@ 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 + dest: "{{ syncthing_pre.config_dir }}" + owner: "{{ syncthing_pre.user_group }}" + mode: 0400 notify: restart syncthing - name: start and enables service service: - name: syncthing + name: "{{ syncthing_pre.service }}" 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 |