Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
ansible
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
ansible
Commits
84152fec
Commit
84152fec
authored
Oct 21, 2013
by
Dylan Martin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
unarchive - mvd docs to top of file
parent
da9e2e76
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
38 deletions
+40
-38
library/files/unarchive
+40
-38
No files found.
library/files/unarchive
View file @
84152fec
...
...
@@ -19,6 +19,46 @@
# You should have received a copy of the GNU General Public License
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
DOCUMENTATION
=
'''
---
module: unarchive
short_description: Copies archive to remote locations and unpacks them
description:
- The M(unarchive) module copies an archive file on the local box to remote locations and unpacks them.
options:
src:
description:
- Local path to archive file to copy to the remote server; can be absolute or relative.
required: true
default: null
dest:
description:
- Remote absolute path where the archive should be unpacked
required: true
default: null
author: Dylan Martin
todo:
- detect changed/unchanged for .zip files
- handle common unarchive args, like preserve owner/timestamp etc...
notes:
- requires tar/unzip command on host
- can handle gzip, bzip2 and xz compressed as well as uncompressed tar files
- detects type of archive automatically
- uses tar's --diff arg to calculate if changed or not. If this arg is not
supported, it will always unpack the archive
- does not detect if a .zip file is different from destination - always unzips
- existing files/directories in the destination which are not in the archvie
are not touched. This is the same behavior as a normal archive extraction
- existing files/directories in the destination which are not in the archvie
are ignored for purposes of deciding if the archive should be unpacked or not
'''
EXAMPLES
=
'''
# Example from Ansible Playbooks
- unarchive: src=foo.tgz dest=/var/lib/foo
'''
import
os
# class to handle .zip files
class
_zipfile
(
object
):
...
...
@@ -96,44 +136,6 @@ class _tarxz(_tgzfile):
self
.
module
=
module
self
.
zipflag
=
'J'
DOCUMENTATION
=
'''
---
module: unarchive
short_description: Copies archive to remote locations and unpacks them
description:
- The M(unarchive) module copies an archive file on the local box to remote locations and unpacks them.
options:
src:
description:
- Local path to archive file to copy to the remote server; can be absolute or relative.
required: true
default: null
dest:
description:
- Remote absolute path where the archive should be unpacked
required: true
default: null
author: Dylan Martin
todo:
- detect changed/unchanged for .zip files
- handle common unarchive args, like preserve owner/timestamp etc...
notes:
- requires tar/unzip command on host
- can handle gzip, bzip2 and xz compressed as well as uncompressed tar files
- detects type of archive automatically
- uses tar's --diff arg to calculate if changed or not. If this arg is not
supported, it will always unpack the archive
- does not detect if a .zip file is different from destination - always unzips
- existing files/directories in the destination which are not in the archvie
are not touched. This is the same behavior as a normal archive extraction
- existing files/directories in the destination which are not in the archvie
are ignored for purposes of deciding if the archive should be unpacked or not
'''
EXAMPLES
=
'''
# Example from Ansible Playbooks
- unarchive: src=foo.tgz dest=/var/lib/foo
'''
# try handlers in order and return the one that works or bail if none work
def
pick_handler
(
src
,
dest
,
module
):
handlers
=
[
_tgzfile
,
_zipfile
,
_tarfile
,
_tarbzip
,
_tarxz
]
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment