|
|
|
@ -48,12 +48,14 @@ class ActionModule(object):
|
|
|
|
|
options.update(utils.parse_kv(module_args))
|
|
|
|
|
source = options.get('src', None)
|
|
|
|
|
dest = options.get('dest', None)
|
|
|
|
|
copy = options.get('copy', True)
|
|
|
|
|
|
|
|
|
|
if source is None or dest is None:
|
|
|
|
|
result=dict(failed=True, msg="src (or content) and dest are required")
|
|
|
|
|
return ReturnData(conn=conn, result=result)
|
|
|
|
|
|
|
|
|
|
source = template.template(self.runner.basedir, source, inject)
|
|
|
|
|
if copy:
|
|
|
|
|
if '_original_file' in inject:
|
|
|
|
|
source = utils.path_dwim_relative(inject['_original_file'], 'files', source, self.runner.basedir)
|
|
|
|
|
else:
|
|
|
|
@ -64,6 +66,7 @@ class ActionModule(object):
|
|
|
|
|
result = dict(failed=True, msg="dest must be an existing dir")
|
|
|
|
|
return ReturnData(conn=conn, result=result)
|
|
|
|
|
|
|
|
|
|
if copy:
|
|
|
|
|
# transfer the file to a remote tmp location
|
|
|
|
|
tmp_src = tmp + 'source'
|
|
|
|
|
conn.put_file(source, tmp_src)
|
|
|
|
|