A module to wrap (non-Windows) archive calls
New in version 2014.1.0.
salt.modules.archive.
gunzip
(gzipfile, template=None)¶Uses the gunzip command to unpack gzip files
Can be set to 'jinja' or another supported template engine to render the command arguments before execution:
salt '*' archive.gunzip template=jinja /tmp/{{grains.id}}.txt.gz
CLI Example:
# Create /tmp/sourcefile.txt
salt '*' archive.gunzip /tmp/sourcefile.txt.gz
salt.modules.archive.
gzip
(sourcefile, template=None)¶Uses the gzip command to create gzip files
Can be set to 'jinja' or another supported template engine to render the command arguments before execution:
salt '*' archive.gzip template=jinja /tmp/{{grains.id}}.txt
CLI Example:
# Create /tmp/sourcefile.txt.gz
salt '*' archive.gzip /tmp/sourcefile.txt
salt.modules.archive.
rar
(rarfile, sources, template=None, cwd=None)¶Uses rar for Linux to create rar files
Run the rar command from the specified directory. Use this argument along with relative file paths to create rar files which do not contain the leading directories. If not specified, this will default to the home directory of the user under which the salt minion process is running.
New in version 2014.7.1.
Can be set to 'jinja' or another supported template engine to render the command arguments before execution:
salt '*' archive.rar template=jinja /tmp/rarfile.rar '/tmp/sourcefile1,/tmp/{{grains.id}}.txt'
CLI Example:
salt '*' archive.rar /tmp/rarfile.rar /tmp/sourcefile1,/tmp/sourcefile2
salt.modules.archive.
tar
(options, tarfile, sources=None, dest=None, cwd=None, template=None)¶Note
This function has changed for version 0.17.0. In prior versions, the
cwd
and template
arguments must be specified, with the source
directories/files coming as a space-separated list at the end of the
command. Beginning with 0.17.0, sources
must be a comma-separated
list, and the cwd
and template
arguments are optional.
Uses the tar command to pack, unpack, etc. tar files
Can be set to 'jinja' or another supported template engine to render the command arguments before execution:
salt '*' archive.tar cjvf /tmp/salt.tar.bz2 {{grains.saltpath}} template=jinja
CLI Examples:
# Create a tarfile
salt '*' archive.tar cjvf /tmp/tarfile.tar.bz2 /tmp/file_1,/tmp/file_2
# Unpack a tarfile
salt '*' archive.tar xf foo.tar dest=/target/directory
salt.modules.archive.
unrar
(rarfile, dest, excludes=None, template=None)¶Uses rar for Linux to unpack rar files
Can be set to 'jinja' or another supported template engine to render the command arguments before execution:
salt '*' archive.unrar template=jinja /tmp/rarfile.rar /tmp/{{grains.id}}/ excludes=file_1,file_2
CLI Example:
salt '*' archive.unrar /tmp/rarfile.rar /home/strongbad/ excludes=file_1,file_2
salt.modules.archive.
unzip
(zipfile, dest, excludes=None, template=None, options=None)¶unzip
command to unpack zip files. This command is part of theInfo-ZIP suite of tools, and is typically packaged as simply unzip
.
Can be set to 'jinja' or another supported template engine to render the command arguments before execution:
salt '*' archive.unzip template=jinja /tmp/zipfile.zip /tmp/{{grains.id}}/ excludes=file_1,file_2
unzip
binary.CLI Example:
salt '*' archive.unzip /tmp/zipfile.zip /home/strongbad/ excludes=file_1,file_2
salt.modules.archive.
zip_
(zipfile, sources, template=None, cwd=None)¶Uses the zip
command to create zip files. This command is part of the
Info-ZIP suite of tools, and is typically packaged as simply zip
.
Can be set to 'jinja' or another supported template engine to render the command arguments before execution:
salt '*' archive.zip template=jinja /tmp/zipfile.zip /tmp/sourcefile1,/tmp/{{grains.id}}.txt
Use this argument along with relative paths in sources
to create
zip files which do not contain the leading directories. If not
specified, the zip file will be created as if the cwd was /
, and
creating a zip file of /foo/bar/baz.txt
will contain the parent
directories foo
and bar
. To create a zip file containing just
baz.txt
, the following command would be used:
salt '*' archive.zip /tmp/baz.zip baz.txt cwd=/foo/bar
New in version 2014.7.1.
CLI Example:
salt '*' archive.zip /tmp/zipfile.zip /tmp/sourcefile1,/tmp/sourcefile2