From 54567fda34f73b49c9b7878a23194ee294d3f6c6 Mon Sep 17 00:00:00 2001
From: Lars Beckers <lars.beckers@rwth-aachen.de>
Date: Fri, 21 Apr 2017 20:27:57 +0200
Subject: [PATCH] move postgres snapshots from root's crontab to cron.d

---
 postgres/files/crontab  | 18 +++++-------------
 postgres/tasks/main.yml |  2 +-
 2 files changed, 6 insertions(+), 14 deletions(-)

diff --git a/postgres/files/crontab b/postgres/files/crontab
index 0f991b9..9cc887a 100644
--- a/postgres/files/crontab
+++ b/postgres/files/crontab
@@ -1,13 +1,5 @@
-# 
-# For more information see the manual pages of crontab(5) and cron(8)
-# 
-# m h  dom mon dow   command
-5,20,35,50 * * * *    /usr/bin/rsnapshot frequently
-
-3 * * * *         /usr/bin/rsnapshot hourly
-
-51 23 * * *         /usr/bin/rsnapshot daily
-
-41 23 * * 6         /usr/bin/rsnapshot weekly
-
-31 23 2 * *         /usr/bin/rsnapshot monthly
+5,20,35,50 * * * * root /usr/bin/rsnapshot frequently
+3 * * * * root /usr/bin/rsnapshot hourly
+51 23 * * * root /usr/bin/rsnapshot daily
+41 23 * * 6 root /usr/bin/rsnapshot weekly
+31 23 2 * * root /usr/bin/rsnapshot monthly
diff --git a/postgres/tasks/main.yml b/postgres/tasks/main.yml
index f9a0d4d..3a00f67 100644
--- a/postgres/tasks/main.yml
+++ b/postgres/tasks/main.yml
@@ -42,7 +42,7 @@
     - config
 
 - name: ensure rsnapshot is running regularly
-  copy: src=crontab dest=/var/spool/cron/crontabs/root owner=root group=root mode=0600
+  copy: src=crontab dest=/etc/cron.d/postgres-snapshot owner=root group=root mode=0644
   tags:
     - postgres
     - rsnapshot
-- 
GitLab