From b678cf783cce38424dc821ce49179e8ef4bfb37b Mon Sep 17 00:00:00 2001 From: Jeroen Hoekx Date: Wed, 18 Apr 2012 11:40:15 +0200 Subject: [PATCH 1/2] Template the source file of the copy module. --- 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 7ce2275a7b9..a029d73afab 100755 --- a/lib/ansible/runner.py +++ b/lib/ansible/runner.py @@ -368,7 +368,11 @@ class Runner(object): dest = options.get('dest', None) if source is None or dest is None: return (host, True, dict(failed=True, msg="src and dest are required"), '') - + + # apply templating to source argument + inject = self.setup_cache.get(conn.host,{}) + source = utils.template(source, inject) + # transfer the file to a remote tmp location tmp_src = tmp + source.split('/')[-1] conn.put_file(utils.path_dwim(self.basedir, source), tmp_src) From 22ff8282a8277166c727b995f9e6e1d7e809d9bb Mon Sep 17 00:00:00 2001 From: Jeroen Hoekx Date: Wed, 18 Apr 2012 14:26:33 +0200 Subject: [PATCH 2/2] Template template module source. --- lib/ansible/runner.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/ansible/runner.py b/lib/ansible/runner.py index a029d73afab..dd7b66af275 100755 --- a/lib/ansible/runner.py +++ b/lib/ansible/runner.py @@ -463,6 +463,10 @@ class Runner(object): else: metadata = '~/.ansible/setup' + # apply templating to source argument + inject = self.setup_cache.get(conn.host,{}) + source = utils.template(source, inject) + # first copy the source template over temppath = tmp + os.path.split(source)[-1] conn.put_file(utils.path_dwim(self.basedir, source), temppath)