diff --git a/postgres/tasks/main.yml b/postgres/tasks/main.yml index 1867e9cf5be8eab78ee4afe5c6113f8e50a87b4b..30915a9811b6a659fc3782af56f5d2cf05109fca 100644 --- a/postgres/tasks/main.yml +++ b/postgres/tasks/main.yml @@ -36,23 +36,26 @@ state: started enabled: true -- name: ensure we have our postgres backup script - copy: - src: "pgbackup{{ '-bullseye' if ansible_distribution_major_version|int(default=99) > 10 else '' }}.sh" - dest: /usr/local/bin/pgbackup.sh - owner: root - group: root - mode: '0755' +- name: configure snapshots + when: '"servers_rsnapshot" in group_names' + block: + - name: ensure we have our postgres backup script + copy: + src: "pgbackup{{ '-bullseye' if ansible_distribution_major_version|int(default=99) > 10 else '' }}.sh" + dest: /usr/local/bin/pgbackup.sh + owner: root + group: root + mode: '0755' -- name: ensure we have our rsnapshot config - copy: - src: rsnapshot.conf - dest: /etc/rsnapshot.d/postgres.conf - owner: root - group: root - mode: '0644' + - name: ensure we have our rsnapshot config + copy: + src: rsnapshot.conf + dest: /etc/rsnapshot.d/postgres.conf + owner: root + group: root + mode: '0644' -- name: remove obsolete crontab - file: - path: /etc/cron.d/postgres-snapshot - state: absent + - name: remove obsolete crontab + file: + path: /etc/cron.d/postgres-snapshot + state: absent