]> git.phdru.name Git - ansible.git/commitdiff
Feat(update-root): Use module `synchronize`
authorOleg Broytman <phd@phdru.name>
Fri, 26 Jul 2019 15:43:23 +0000 (18:43 +0300)
committerOleg Broytman <phd@phdru.name>
Fri, 26 Jul 2019 15:48:43 +0000 (18:48 +0300)
Use `synchronize:` delegated to the remote host instead of running
`rsync` directly with `command:`.

playbooks/debian/update-root.yml

index b2ef0ec5272e8fb881e800243cec1ab996b5d0d2..1deda04634252fc20637a40e9321ecd937eef1a0 100644 (file)
@@ -4,9 +4,14 @@
   gather_facts: false
   tasks:
     - name: "Update ~root - sync directories from ~phd"
-      command: "rsync -rlt --info=name ~phd/{{ item }} ~root"
-      register: rsync
-      changed_when: rsync.stdout != ''
+      synchronize:
+        src: "~phd/{{ item }}"
+        dest: ~root
+        archive: no  # avoid setting owner/group
+        recursive: yes
+        links: yes
+        times: yes
+      delegate_to: "{{ inventory_hostname }}"
       loop: ['.vim', 'bin', 'lib']
 
     - name: "Update ~root - sync files from ~phd"