community.general.iso_extract (8.5.0) — module

Extract files from an ISO image

Authors: Jeroen Hoekx (@jhoekx), Matt Robinson (@ribbons), Dag Wieers (@dagwieers)

Install collection

Install with ansible-galaxy collection install community.general:==8.5.0


Add to requirements.yml

  collections:
    - name: community.general
      version: 8.5.0

Description

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

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Extract kernel and ramdisk from a LiveCD
  community.general.iso_extract:
    image: /tmp/rear-test.iso
    dest: /tmp/virt-rear/
    files:
    - isolinux/kernel
    - isolinux/initrd.cgz

Inputs

    
dest:
    description:
    - The destination directory to extract files to.
    required: true
    type: path

files:
    description:
    - A list of files to extract from the image.
    - Extracting directories does not work.
    elements: str
    required: true
    type: list

force:
    default: true
    description:
    - If V(true), which will replace the remote file when contents are different than
      the source.
    - If V(false), the file will only be extracted and copied if the destination does
      not already exist.
    type: bool

image:
    aliases:
    - path
    - src
    description:
    - The ISO image to extract files from.
    required: true
    type: path

executable:
    description:
    - The path to the C(7z) executable to use for extracting files from the ISO.
    - If not provided, it will assume the value V(7z).
    type: path