X-Git-Url: https://git.phdru.name/?a=blobdiff_plain;f=playbooks%2Fdebian%2Fsa-merge-all.yml;h=dbf9b4c1b00b093a40d96053f74e7a4c222d0d47;hb=5066f85b3351fd1cb53e5fe9d484644387fc1ddc;hp=a251e989071a62aa3bca2216e03d08cf9af5edf0;hpb=98c4db6829d2fb02aef000976b68956351a05ca0;p=ansible.git diff --git a/playbooks/debian/sa-merge-all.yml b/playbooks/debian/sa-merge-all.yml index a251e98..dbf9b4c 100644 --- a/playbooks/debian/sa-merge-all.yml +++ b/playbooks/debian/sa-merge-all.yml @@ -15,7 +15,7 @@ state: stopped - name: Backup SpamAssassin DB - shell: "exec sa-learn --backup >~/tmp/sa-learn.backup@{{ inventory_hostname }}" + shell: "sa-learn --sync && exec sa-learn --backup >~/tmp/sa-learn.backup@{{ inventory_hostname }}" - name: Fetch SpamAssassin DB backup synchronize: src: "~/tmp/sa-learn.backup@{{ inventory_hostname }}" @@ -24,7 +24,9 @@ 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: @@ -33,7 +35,9 @@ 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"