A simple Ansible role for building RHEL images with Image Builder.
This role builds custom RHEL images with RHEL Image Builder. The role uses a given image blueprint from a Git repository and stores results on the build host.
First, install this role:
mkdir roles
cat << EOF > roles/requirements.yml
---
roles:
- src: https://github.com/myllynen/rhel-image.git
type: git
version: master
EOF
ansible-galaxy role install -p roles -r roles/requirements.yml
Next, on a blueprint repository customize an image blueprint:
vi base-image.toml
git commit -m "Update base-image" base-image.toml
git push
Then, create a playbook to use this role:
---
- name: Build RHEL image with Image Builder
hosts: all
become: true
vars:
create_user: false
git_remote_repo: file:///tmp/rhel-image-blueprints.git
git_repo_checkout: master
image_blueprint: base-image
image_size_kb: 20480
image_output_type: qcow2
image_download_dir: /tmp/images
roles:
- rhel-image
See defaults/main.yml for all the supported parameters.
Finally, build the image on a build host:
ansible-playbook -i 192.168.122.123, image_builder.yml
See also https://github.com/myllynen/ansible-packer.
See also https://github.com/myllynen/rhel-ansible-roles.
GPLv2+