mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Merge pull request #163 from jhoekx/template-copy-args
Template the source file of the copy module.
This commit is contained in:
commit
f408060275
1 changed files with 9 additions and 1 deletions
|
@ -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)
|
||||
|
@ -459,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)
|
||||
|
|
Loading…
Reference in a new issue