X-Git-Url: https://git.phdru.name/?a=blobdiff_plain;f=playbooks%2Fdebian%2Fsa-merge-all.yml;h=dbf9b4c1b00b093a40d96053f74e7a4c222d0d47;hb=c821c73a3f894ee0783adf0a7e9fc14817ab1e42;hp=7c35a9331ee76271891886d7248982ea976bb547;hpb=f469669e463367cbdad0d4842ace6308c1bbe312;p=ansible.git diff --git a/playbooks/debian/sa-merge-all.yml b/playbooks/debian/sa-merge-all.yml index 7c35a93..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: @@ -32,8 +34,10 @@ synchronize: src: "~/tmp/sa-learn.backup" dest: "~/tmp/sa-learn.backup" - - name: Combine SpamAssassin DB backups - shell: "cd tmp && sa-learn --clear && sa-learn --restore sa-learn.backup && exec sa-learn --sync" + - name: Restore combined SpamAssassin DB + 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"