W3cubDocs

/Ansible

iso_extract - Extract files from an ISO image

New in version 2.3.

Synopsis

  • This module has two possible ways of operation.
  • If 7zip is installed on the system, this module extracts files from an ISO into a temporary directory and copies files to a given destination, if needed.
  • If the user has mount-capabilities (CAP_SYS_ADMIN on Linux) this module mounts the ISO image to a temporary location, and copies files to a given destination, if needed.

Requirements (on host that executes module)

  • Either 7z (from 7zip or p7zip package)
  • Or mount capabilities (root-access, or CAP_SYS_ADMIN capability on Linux)

Options

parameter required default choices comments
dest
yes
The destination directory to extract files to.
executable
(added in 2.4)
no 7z
The path to the 7z executable to use for extracting files from the ISO.
files
yes
A list of files to extract from the image.
Extracting directories does not work.
force
(added in 2.4)
no yes
  • yes
  • no
If yes, which will replace the remote file when contents are different than the source.
If no, the file will only be extracted and copied if the destination does not already exist.
aliases: thirsty
image
yes
The ISO image to extract files from.
aliases: path, src

Examples

- name: Extract kernel and ramdisk from a LiveCD
  iso_extract:
    image: /tmp/rear-test.iso
    dest: /tmp/virt-rear/
    files:
    - isolinux/kernel
    - isolinux/initrd.cgz

Notes

Note

  • Only the file checksum (content) is taken into account when extracting files from the ISO image. If force=no, only checks the presence of the file.
  • In Ansible v2.3 this module was using mount and umount commands only, requiring root access. This is no longer needed with the introduction of 7zip for extraction.

Status

This module is flagged as preview which means that it is not guaranteed to have a backwards compatible interface.

For help in developing on modules, should you be so inclined, please read Community Information & Contributing, Testing Ansible and Developing Modules.

© 2012–2017 Michael DeHaan
© 2017 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/latest/iso_extract_module.html