Optionally unarchive a file already on the remote machine
This commit is contained in:
parent
4c35b7f380
commit
4df9dd9232
1 changed files with 11 additions and 1 deletions
|
@ -37,6 +37,12 @@ options:
|
|||
- Remote absolute path where the archive should be unpacked
|
||||
required: true
|
||||
default: null
|
||||
copy:
|
||||
description:
|
||||
- Should the file be copied from the local to the remote machine?
|
||||
required: false
|
||||
choices: [ "yes", "no" ]
|
||||
default: "yes"
|
||||
author: Dylan Martin
|
||||
todo:
|
||||
- detect changed/unchanged for .zip files
|
||||
|
@ -153,6 +159,7 @@ def main():
|
|||
src = dict(required=True),
|
||||
original_basename = dict(required=False), # used to handle 'dest is a directory' via template, a slight hack
|
||||
dest = dict(required=True),
|
||||
copy = dict(default=True, type='bool'),
|
||||
),
|
||||
add_file_common_args=True,
|
||||
)
|
||||
|
@ -162,7 +169,10 @@ def main():
|
|||
|
||||
# did tar file arrive?
|
||||
if not os.path.exists(src):
|
||||
module.fail_json(msg="Source '%s' failed to transfer" % (src))
|
||||
if copy:
|
||||
module.fail_json(msg="Source '%s' failed to transfer" % (src))
|
||||
else:
|
||||
module.fail_json(msg="Source '%s' does not exist" % (src))
|
||||
if not os.access(src, os.R_OK):
|
||||
module.fail_json(msg="Source '%s' not readable" % (src))
|
||||
|
||||
|
|
Loading…
Reference in a new issue