Using Image Composer (Image builder) with Foreman

Hello,

Foreman does ship with an parameters which use “liveimg” kickstart statement to install OS from an existing image. This is used for Red Hat Virtualization node (or oVirt Hypervisor), but it is great workflow that can be used to provision generic nodes too. While we would like to focus on this sometimes in the future, there are few workarounds you need to do if you want to explore this kind of provisioning.

Terry from the RHEL team shared with me those workarounds, so I thought it would be great so share it with you in case you want to test it. Any feedback is welcome!

Add the following package groups and packages to the %packages section of /usr/share/lorax/composer/tar.ks. Note, that this might get overwritten in future versions. We need to request a bugfix to add these more permanently.

@core
@anaconda-tools
authconfig

Blueprint

# cat RHEL_Minimal.toml
version = "0.0.10"
description = "A minimal image containing only @core"
groups = []
modules = []
name = "RHEL_Minimal"

[[packages]]
version = "*"
name = "bash-completion"

[[packages]]
version = "*"
name = "cockpit"

[[packages]]
version = "*"
name = "cockpit-packagekit"

[[packages]]
version = "*"
name = "insights-client"

[[packages]]
version = "*"
name = "vim-enhanced"

[customizations]
hostname = "rhel-min-template"

[customizations.firewall]

[customizations.firewall.services]
enabled = ["ssh", "cockpit"]

[customizations.services]
enabled = ["sshd", "cockpit.socket"]

[[customizations.user]]
description = "ansible_admin"
groups = ["wheel"]
name = "admin"
key = "ssh-rsa AAAxxxxxxxxxxxxxxxx demo"
password = "$6$xxxxxx"

Kickstart

#
# This kickstart template will use the RHEL 8.4+ Boot DVD ISO
# to automation installation of a TAR OS image created by
# RHEL 8 Image Builder.
#

lang en_US
keyboard us
timezone America/New_York --isUtc
install
liveimg --url="http://192.168.1.5/kicks/rhel79-gold.tar.xz"
zerombr
clearpart --all --initlabel
#autopart --type=plain --fstype=xfs 
part /boot --fstype=xfs --size=1024 --asprimary
part pv.0 --fstype=lvmpv --ondisk=vda  --size=1 --grow  
volgroup system --pesize=4096 pv.0 
logvol / --vgname=system --name=root --fstype=xfs --percent=80
logvol /var --vgname=system --name=var --fstype=xfs --percent=10 --grow --maxsize=5000
logvol /var/log --vgname=system --name=varlog --fstype=xfs --percent=5 --grow --maxsize=5000
logvol swap  --vgname=system --name=swap --fstype="swap" --recommended
reboot
#text
# firstboot --disable
skipx
network --bootproto=dhcp
auth --passalgo=sha512 --useshadow

# Configured in Blueprint instead
# selinux --enforcing

# Configure firewall & ervices in Blueprint instead
# firewall --enabled --http --ssh

user --name=testuser --groups=wheel --gecos="test user" --iscrypted --password="$6$xxxx"
sshkey --username=testuser "ssh-rsa AAAxxxxx demo"
#rootpw --iscrypted "$6$xxxxxx"
#sshkey --username=root "ssh-rsa AAAAxxxxx demo"

Have fun!

2 Likes

Hello,
in order to boost the netboot kickstart install, Ive give a try to osbuilder in a foreman 3.2 / vmware 7 rhel8.6 build process. And that was not very fun :slight_smile: Maybe because building vmware-guest ask for more digging … ??
My blueprint is a bit longer, is there a way to share, discuss blueprint as it could be for kickstart templates somewere in the foreman project ?
Regards

I think you’ve found the right place.
Create a new topic with Community or the Support label - whichever suits best after you’ve typed up your post.