From 13d7a61160e0fda525016885f372a54222ba50c6 Mon Sep 17 00:00:00 2001 From: Dmitry Marakasov Date: Fri, 27 May 2016 08:54:03 +0400 Subject: [PATCH] Fix crontab argument order for writing (#3750) Currently, when writing user's crontab, ansible calls crontab -u This is incorrect according to crontab(1) on both FreeBSD and Linux, which suggest that file argument should be the last. At least on FreeBSD, this leads to incorrect cron module bahavior which writes to root's crontab instead of users's --- lib/ansible/modules/system/cron.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ansible/modules/system/cron.py b/lib/ansible/modules/system/cron.py index 5884fa82290..77877d57902 100644 --- a/lib/ansible/modules/system/cron.py +++ b/lib/ansible/modules/system/cron.py @@ -488,7 +488,7 @@ class CronTab(object): return "chown %s %s ; su '%s' -c '%s %s'" % (pipes.quote(self.user), pipes.quote(path), pipes.quote(self.user), CRONCMD, pipes.quote(path)) else: user = '-u %s' % pipes.quote(self.user) - return "%s %s %s" % (CRONCMD , pipes.quote(path), user) + return "%s %s %s" % (CRONCMD , user, pipes.quote(path))