From 041df1eac1713764bc7f4eb3463ffec099bfb921 Mon Sep 17 00:00:00 2001 From: Robin Sonnabend <robin@fsmpi.rwth-aachen.de> Date: Fri, 13 Aug 2021 01:17:18 +0200 Subject: [PATCH] Only configure postgres snapshots with rsnapshot --- postgres/tasks/main.yml | 39 +++++++++++++++++++++------------------ 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/postgres/tasks/main.yml b/postgres/tasks/main.yml index 1867e9c..30915a9 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 -- GitLab