stefanhacker.ansible_inject_packages_into_iso
Role: ansible-inject-packages-into-iso
This role allows you to add packages to a live ISO. I need a live Debian ISO with a German keyboard layout and SSH access for the root user. So, I created this role to easily build our custom ISO repeatedly, without hassle or confusion.
Example Playbook
---
- hosts: myhosts
become: yes
gather_facts: yes
roles:
- role: inject_packages_into_iso
enable_download: True
download_public_iso_url: https://cdimage.debian.org/debian-cd/current-live/amd64/iso-hybrid/debian-live-11.3.0-amd64-standard.iso
live_folder_name: live/
path_to_src_iso_file_with_filename: /tmp/iso/debian11.iso
path_to_dest_iso_filename: /srv/tftp/images/debianlive_ssh/x86_64/debianlive_ssh.iso
install_ssh_server: True
clean_working_dir: False
packages_to_install:
- "htop"
- "mc"
set_root_pass: "installer10"
cpu_count_for_make_squashfs_again: 10
XKBMODEL: pc105
XKBLAYOUT: de
XKBVARIANT: nodeadkeys
XKBOPTIONS: ""
BACKSPACE: ""
hostname: installer-strange
Description of Variables to Set
path_to_src_iso_file_with_filename: The path where the source ISO will be copied manually or downloaded if a URL is provided. This is the base directory of the ISO file. Temporary path:
/tmp/iso/debian11.iso
.path_to_dest_iso_filename: The destination path for the new ISO (e.g., to a TFTP directory). The folder should not exist; it will be created if necessary. Destination path:
/srv/tftp/images/debianlive_ssh/x86_64/debianlive_ssh.iso
.live_folder_name: This is the folder where the squash initrd files are located. For Debian, it is called "live"; for Linux Mint, it is "casper."
clean_working_dir: This cleans only the working directory where the extracted files and recreated squashfs are stored initially. Set to
False
.clean_tmp_folder: Cleans the temporary folder after all work is done. Set to
False
.enable_download: When set to
True
, the ISO will be downloaded from the URL specified indownload_public_iso_url
.cpu_count_for_make_squashfs_again: Number of CPU cores to use for rebuilding the squashfs. Using one core can take an hour or more; it's a resource-intensive process, so be cautious with the number of cores you choose.
download_public_iso_url: URL for the ISO file:
https://cdimage.debian.org/debian-cd/current-live/amd64/iso-hybrid/debian-live-11.3.0-amd64-standard.iso
.install_ssh_server: Set to
True
to install the OpenSSH server and allow root login with a password. Default isFalse
.packages_to_install: List of packages to install. By default, it's empty.
working_dir: The working directory for the operation (do not change):
{{ path_to_src_iso_file_with_filename | dirname }}/work/
.set_root_pass: Assigns a root password. If left empty, it will not be changed.
hostname: If empty, the hosts file and hostname files will remain unchanged.
XKBMODEL: Keyboard model, set to
pc105
.XKBLAYOUT: Language layout, set to
de
for German.XKBVARIANT: Keyboard variants, set to
nodeadkeys
.XKBOPTIONS: Other keyboard options, set to empty.
BACKSPACE: A few options for backspace, set to empty.
Injects configs und Packages into Debian/ubuntu based Live ISOs
ansible-galaxy install stefanhacker.ansible_inject_packages_into_iso