From 31d3f52b286466c60db195ea6f23350fdc3812fc Mon Sep 17 00:00:00 2001 From: Matthew Williams Date: Wed, 11 Apr 2012 09:14:10 -0700 Subject: [PATCH] fetch to host specific directory --- lib/ansible/runner.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/ansible/runner.py b/lib/ansible/runner.py index e112081cf2..183153fc26 100755 --- a/lib/ansible/runner.py +++ b/lib/ansible/runner.py @@ -466,7 +466,9 @@ class Runner(object): #load up options options = utils.parse_kv(self.module_args) source = options['src'] - dest = options['dest'] + + filename = os.path.basename(source) + dest = "%s/%s/%s" % (options['dest'], host, filename) changed = False failed = None @@ -482,6 +484,8 @@ class Runner(object): remote_md5 = self._exec_command(conn, "md5sum %s" % source, tmp, True)[0].split()[0] 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]