From a8b494bab51c5b2d00ed6692482554a80986f08e Mon Sep 17 00:00:00 2001 From: Matthew Williams Date: Sat, 19 May 2012 18:59:23 -0700 Subject: [PATCH] dim fetch dest after templating --- lib/ansible/runner.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/ansible/runner.py b/lib/ansible/runner.py index a9a0945feaa..9e903871e00 100644 --- a/lib/ansible/runner.py +++ b/lib/ansible/runner.py @@ -452,13 +452,13 @@ class Runner(object): inject = self.setup_cache.get(conn.host,{}) source = utils.template(source, inject, self.setup_cache) + # apply templating to dest argument + dest = utils.template(dest, inject, self.setup_cache) + # files are saved in dest dir, with a subdir for each host, then the filename dest = "%s/%s/%s" % (utils.path_dwim(self.basedir, dest), host, source) dest = dest.replace("//","/") - # apply templating to dest argument - dest = utils.template(dest, inject, self.setup_cache) - # compare old and new md5 for support of change hooks local_md5 = None if os.path.exists(dest): @@ -468,6 +468,7 @@ class Runner(object): if remote_md5 != local_md5: # create the containing directories, if needed os.makedirs(os.path.dirname(dest)) + # fetch the file and check for changes conn.fetch_file(source, dest) new_md5 = os.popen("md5sum %s" % dest).read().split()[0]