|
|
@ -49,11 +49,30 @@ class ActionModule(object):
|
|
|
|
source = options.get('src', None)
|
|
|
|
source = options.get('src', None)
|
|
|
|
dest = options.get('dest', None)
|
|
|
|
dest = options.get('dest', None)
|
|
|
|
copy = utils.boolean(options.get('copy', 'yes'))
|
|
|
|
copy = utils.boolean(options.get('copy', 'yes'))
|
|
|
|
|
|
|
|
creates = options.get('creates', None)
|
|
|
|
|
|
|
|
|
|
|
|
if source is None or dest is None:
|
|
|
|
if source is None or dest is None:
|
|
|
|
result = dict(failed=True, msg="src (or content) and dest are required")
|
|
|
|
result = dict(failed=True, msg="src (or content) and dest are required")
|
|
|
|
return ReturnData(conn=conn, result=result)
|
|
|
|
return ReturnData(conn=conn, result=result)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if creates:
|
|
|
|
|
|
|
|
# do not run the command if the line contains creates=filename
|
|
|
|
|
|
|
|
# and the filename already exists. This allows idempotence
|
|
|
|
|
|
|
|
# of command executions.
|
|
|
|
|
|
|
|
module_args_tmp = "path=%s" % creates
|
|
|
|
|
|
|
|
module_return = self.runner._execute_module(conn, tmp, 'stat', module_args_tmp, inject=inject,
|
|
|
|
|
|
|
|
complex_args=complex_args, persist_files=True)
|
|
|
|
|
|
|
|
stat = module_return.result.get('stat', None)
|
|
|
|
|
|
|
|
if stat and stat.get('exists', False):
|
|
|
|
|
|
|
|
return ReturnData(
|
|
|
|
|
|
|
|
conn=conn,
|
|
|
|
|
|
|
|
comm_ok=True,
|
|
|
|
|
|
|
|
result=dict(
|
|
|
|
|
|
|
|
skipped=True,
|
|
|
|
|
|
|
|
msg=("skipped, since %s exists" % creates)
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
dest = self.runner._remote_expand_user(conn, dest, tmp) # CCTODO: Fix path for Windows hosts.
|
|
|
|
dest = self.runner._remote_expand_user(conn, dest, tmp) # CCTODO: Fix path for Windows hosts.
|
|
|
|
source = template.template(self.runner.basedir, os.path.expanduser(source), inject)
|
|
|
|
source = template.template(self.runner.basedir, os.path.expanduser(source), inject)
|
|
|
|
if copy:
|
|
|
|
if copy:
|
|
|
|