]> git.phdru.name Git - ansible.git/blobdiff - playbooks/debian/sa-merge-all.yml
Feat: Module `synchronize` was moved to `ansible.posix` namespace
[ansible.git] / playbooks / debian / sa-merge-all.yml
index 253aa98d33af413fa9ca761d8a3703aa0dcceba6..0fade9805c663b7c623b4b36245124ab09af34f2 100644 (file)
       - name: Backup SpamAssassin DB
         shell: "sa-learn --sync && exec sa-learn --backup >~/tmp/sa-learn.backup@{{ inventory_hostname }}"
       - name: Fetch SpamAssassin DB backup
-        synchronize:
+        ansible.posix.synchronize:
           src: "~/tmp/sa-learn.backup@{{ inventory_hostname }}"
           dest: "~/tmp/sa-learn.backup@{{ inventory_hostname }}"
           mode: pull
       when: inventory_hostname != 'localhost'
 
     - name: Combine SpamAssassin DB backups
-      shell: "cd ~/tmp && exec cat sa-learn.backup.* >sa-learn.backup"
+      shell: "exec {{ playbook_dir }}/sa-merge-all.py -o sa-learn.backup sa-learn.backup@*"
+      args:
+        chdir: "~/tmp"
       when: inventory_hostname == 'localhost'
 
     - block:
       - name: Push combined SpamAssassin DB backup
-        synchronize:
+        ansible.posix.synchronize:
           src: "~/tmp/sa-learn.backup"
           dest: "~/tmp/sa-learn.backup"
       - name: Restore combined SpamAssassin DB
-        shell: "cd tmp && sa-learn --clear && sa-learn --restore sa-learn.backup && exec sa-learn --sync"
+        shell: "sa-learn --clear && sa-learn --restore sa-learn.backup && exec sa-learn --sync"
+        args:
+          chdir: "~/tmp"
 
       - name: Start SpamAssassin
         become: true
@@ -48,4 +52,6 @@
       when: inventory_hostname != 'localhost'
 
     - name: Cleanup
-      shell: "cd ~/tmp && exec rm sa-learn.backup*"
+      shell: "exec rm sa-learn.backup*"
+      args:
+        chdir: "~/tmp"