Attributes the file or directory should have. To get supported flags look at the man page for chattr on the target system. This string should contain the attributes in the same order as the one displayed by lsattr.

= operator is assumed as default, otherwise + or - operators need to be included in the string.

aliases: attr

copy

boolean

Choices:

no

yes ←

If true, the file is copied from local 'master' to the target machine, otherwise, the plugin will look for src archive at the target machine.

This option has been deprecated in favor of remote_src.

This option is mutually exclusive with remote_src.

creates

-

added in 1.6

If the specified absolute path (file or directory) already exists, this step will not be run.

decrypt

boolean

added in 2.4

Choices:

no

yes ←

This option controls the autodecryption of source files using vault.

dest

-
/ required

Remote absolute path where the archive should be unpacked.

exclude

-

added in 2.1

List the directory and file entries that you would like to exclude from the unarchive action.

extra_opts

-

added in 2.1

Default:

Specify additional options by passing in an array.

group

-

Name of the group that should own the file/directory, as would be fed to chown.

keep_newer

boolean

added in 2.1

Choices:

no ←

yes

Do not replace existing files that are newer than files from the archive.

list_files

boolean

added in 2.0

Choices:

no ←

yes

If set to True, return the list of files that are contained in the tarball.

mode

-

Mode the file or directory should be. For those used to /usr/bin/chmod remember that modes are actually octal numbers. You must either add a leading zero so that Ansible's YAML parser knows it is an octal number (like 0644 or 01777) or quote it (like '644' or '1777') so Ansible receives a string and can do its own conversion from string into number. Giving Ansible a number without following one of these rules will end up with a decimal number which will have unexpected results. As of version 1.8, the mode may be specified as a symbolic mode (for example, u+rwx or u=rw,g=r,o=r).

owner

-

Name of the user that should own the file/directory, as would be fed to chown.

remote_src

boolean

added in 2.2

Choices:

no ←

yes

Set to yes to indicate the archived file is already on the remote system and not local to the Ansible controller.

This option is mutually exclusive with copy.

selevel

-

Default:

s0

Level part of the SELinux file context. This is the MLS/MCS attribute, sometimes known as the range. _default feature works as for seuser.

serole

-

Role part of SELinux file context, _default feature works as for seuser.

setype

-

Type part of SELinux file context, _default feature works as for seuser.

seuser

-

User part of SELinux file context. Will default to system policy, if applicable. If set to _default, it will use the user portion of the policy if available.

src

-
/ required

If remote_src=no (default), local path to archive file to copy to the target server; can be absolute or relative. If remote_src=yes, path on the target server to existing archive file to unpack.

If remote_src=yes and src contains ://, the remote machine will download the file from the URL first. (version_added 2.0). This is only for simple cases, for full download support use the get_url module.

unsafe_writes

boolean

added in 2.2

Choices:

no ←

yes

By default this module uses atomic operations to prevent data corruption or inconsistent reads from the target files, but sometimes systems are configured or just broken in ways that prevent this. One example is docker mounted files, which cannot be updated atomically from inside the container and can only be written in an unsafe manner.

This option allows Ansible to fall back to unsafe methods of updating files when atomic operations fail (however, it doesn't force Ansible to perform unsafe writes). IMPORTANT! Unsafe writes are subject to race conditions and can lead to data corruption.

validate_certs

boolean

added in 2.2

Choices:

no

yes ←

This only applies if using a https URL as the source of the file.

This should only set to no used on personally controlled sites using self-signed certificate.

-name:Extract foo.tgz into /var/lib/foounarchive:src:foo.tgzdest:/var/lib/foo-name:Unarchive a file that is already on the remote machineunarchive:src:/tmp/foo.zipdest:/usr/local/binremote_src:yes-name:Unarchive a file that needs to be downloaded (added in 2.0)unarchive:src:https://example.com/example.zipdest:/usr/local/binremote_src:yes-name:Unarchive a file with extra optionsunarchive:src:/tmp/foo.zipdest:/usr/local/binextra_opts:---transform-s/^xxx/yyy/