All Projects → rembik → ansible-role-kickstart-iso

rembik / ansible-role-kickstart-iso

Licence: Apache-2.0 License
Ansible role to create kickstart ISO images for RHEL/CentOS.

Programming Languages

Jinja
831 projects

Ansible Role: Kickstart ISO

ci_badge release_badge ansible_role_badge ansible_downloads_badge

This role creates kickstart ISO images for RHEL/CentOS.

Requirements

  • Access to repositories containing system packages and base ISO images, likely on the internet.
  • A recent Ansible version (tested last 2 stable major versions).

The following roles can be installed to ensure all requirements are met, using ansible-galaxy role install -r molecule/resources/requirements.yml :

---
roles:
  - name: rembik.bootstrap

Role Variables

These defaults are set in defaults/main.yml:

---
# https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/anaconda_customization_guide/sect-boot-menu-customization
# https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html-single/performing_an_advanced_rhel_installation

# If kickstart_iso_src_file.name or kickstart_iso_src_file.checksum is undefined,
# kickstart_iso_src_file.checksum_url and kickstart_iso_src_file.search are used
# to dertermine the missing base ISO image file name and checksum
kickstart_iso_src_file:
  name: ''
  search: 'boot'
  checksum: ''
  checksum_url: 'http://mirror.centos.org/centos/8/isos/x86_64/CHECKSUM'
  base_url: 'http://isoredirect.centos.org/centos/8/isos/x86_64'

# Directory where the base ISO images are saved
kickstart_iso_src_dir: '.images/base'
# Directory where the kickstart ISO images are saved
kickstart_iso_dest_dir: '.images/kickstart'
# Allow override of kickstart ISO images, if some already exist (yes|no)
kickstart_iso_override: no

# Pick first disks with minimal physical size kickstart_iso_disk_drive_min_size (GiB)
# until a overall minimal logical OS volume size kickstart_iso_disk_volume_min_size (GiB)
# and create a logical OS volume with maximal size kickstart_iso_disk_volume_max_size (GiB)
kickstart_iso_disk_drive_min_size: 10
kickstart_iso_disk_volume_min_size: 60
kickstart_iso_disk_volume_max_size: 120

kickstart_iso_install_media: 'url --url http://mirror.centos.org/centos/8/BaseOS/x86_64/os/'
kickstart_iso_root_password: 'centos'
kickstart_iso_language: 'de'
kickstart_iso_country: 'DE'
kickstart_iso_timezone: 'Europe/Berlin'
kickstart_iso_completion: 'reboot'
kickstart_iso_network_bootproto: 'dhcp'
kickstart_iso_network_device: 'eth0'
kickstart_iso_network_static_netmask: '255.255.255.0'
kickstart_iso_network_static_gateway: '192.168.1.1'
kickstart_iso_network_static_nameserver: ['192.168.1.1']
# If kickstart_iso_network_bootproto is static use kickstart_iso_network_static_hosts
# to create additional custom static host ISO images
# kickstart_iso_network_static_hosts:
#   - {ip: '192.168.1.1', name: 'host01'}

Dependencies

None.

Example Playbook

This is a sample playbook to create kickstart CentOS 8 ISO image on localhost; made for network releases via DHCP.

---
- hosts: localhost
  become: true

  tasks:
    - include_role:
        name: rembik.kickstart_iso

This is a sample playbook to create kickstart CentOS 7 ISO images on localhost; made for static network configuration.

---
- hosts: localhost
  become: true

  pre_tasks:
    - name: Get all hosts (including IP) from inventory
      set_fact:
        kickstart_iso_network_static_hosts: "{{ (kickstart_iso_network_static_hosts|default([])) +
                                             [dict(ip=hostvars[item].ansible_host,name=(item.split('.')[0]|lower))] }}"
      loop: "{{ groups['all'] }}"

  tasks:
    - include_role:
        name: rembik.kickstart_iso
      vars:
        kickstart_iso_src_file:
          search: 'Minimal'
          checksum_url: 'http://mirror.centos.org/centos/7/isos/x86_64/sha256sum.txt'
          base_url: 'http://isoredirect.centos.org/centos/7/isos/x86_64'
        kickstart_iso_install_media: 'cdrom'
        kickstart_iso_network_bootproto: 'static'
        kickstart_iso_network_static_netmask: '255.255.252.0'
        kickstart_iso_network_static_gateway: '10.0.0.1'
        kickstart_iso_network_static_nameserver:
          - '10.0.2.1'
          - '10.0.3.1'

Tests

This role is tested periodically against the following Linux distributions:

python_badge ansible_badge ansible_previous_badge ansible_latest_badge ansible_devel_badge
alpine_badge x1 x1 e2 e1 e2
centos_badge x x e
debian_badge x1 x1 e2 e1 e2
fedora_badge x1 x1 e2 e1 e2
opensuse_badge x1 x2 x1 x2 e1 e2
redhat_badge x x e
ubuntu_badge x1 x1 e2 e1 e2
xl el

Contributing

If you find issues, please register them at this GitHub project issue page or consider contributing code by following this guideline.

License

Apache License, Version 2.0

Author Information

Brian Rimek

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].