community.general.iso_customize module – Add/remove/change files in ISO file
Note
This module is part of the community.general collection (version 8.6.8).
You might already have this collection installed if you are using the ansible
package.
It is not included in ansible-core
.
To check whether it is installed, run ansible-galaxy collection list
.
To install it, use: ansible-galaxy collection install community.general
.
You need further requirements to be able to use this module,
see Requirements for details.
To use it in a playbook, specify: community.general.iso_customize
.
New in community.general 5.8.0
Synopsis
This module is used to add/remove/change files in ISO file.
The file inside ISO will be overwritten if it exists by option
add_files
.
Aliases: files.iso_customize
Requirements
The below requirements are needed on the host that executes this module.
pycdlib
Parameters
Parameter |
Comments |
---|---|
Allows to add and replace files in the ISO file. Will create intermediate folders inside the ISO file when they do not exist. Default: |
|
The absolute path of the file inside the ISO file. |
|
The path with file name on the machine the module is executed on. |
|
Absolute paths for files inside the ISO file that should be removed. Default: |
|
The path of the customized ISO file. |
|
This is the path of source ISO file. |
Attributes
Attribute |
Support |
Description |
---|---|---|
Support: full |
Can run in |
|
Support: none |
Will return details on what has changed (or possibly needs changing in |
Notes
Note
The
pycdlib
library states it supports Python 2.7 and 3.4+.The function
add_file
in pycdlib will overwrite the existing file in ISO with type ISO9660 / Rock Ridge 1.12 / Joliet / UDF. But it will not overwrite the existing file in ISO with Rock Ridge 1.09 / 1.10. So we take workaround “delete the existing file and then add file for ISO with Rock Ridge”.
Examples
- name: "Customize ISO file"
community.general.iso_customize:
src_iso: "/path/to/ubuntu-22.04-desktop-amd64.iso"
dest_iso: "/path/to/ubuntu-22.04-desktop-amd64-customized.iso"
delete_files:
- "/boot.catalog"
add_files:
- src_file: "/path/to/grub.cfg"
dest_file: "/boot/grub/grub.cfg"
- src_file: "/path/to/ubuntu.seed"
dest_file: "/preseed/ubuntu.seed"
register: customize_iso_result
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key |
Description |
---|---|
Path of the customized ISO file. Returned: on success Sample: |
|
Path of source ISO file. Returned: on success Sample: |