Provisioning RHV 4.1 hypervisors using Satellite 6.2
Overview
The RHV-H 4.1 installation documentation describes a method to provision RHV-H hypervisors using PXE and/or Satellite. This document covers all steps required to archieve such configuration in a repeatable manner.
Prerequisites
- A RHV-H installation ISO file such as
RHVH-4.0-20170308.0-RHVH-x86_64-dvd1.iso
downloaded into Satellite/Capsules. -
rhviso2media.sh
script (see here)
Creating the installation media in Satellite and Capsules
- Deploy the RHV-H iso in /var/lib/pulp/tmp
- Run the
rhviso2media.sh
to populate installation media directories. It will make the following files available:- kernel and initrd files in
tftp://host/ISOFILE/vmlinuz
andtftp://host/ISOFILE/initrd
- DVD installation media in
/var/www/html/pub/ISOFILE
directory - squashfs.img file in
/var/www/html/pub/ISOFILE
directory
- kernel and initrd files in
Example:
# ./rhviso2media.sh RHVH-4.0-20170308.0-RHVH-x86_64-dvd1.iso Mounting /var/lib/pulp/tmp/RHVH-4.0-20170308.0-RHVH-x86_64-dvd1.iso in /mnt/RHVH-4.0-20170308.0-RHVH-x86_64-dvd1.iso ... mount: /dev/loop0 is write-protected, mounting read-only Copying ISO contents to /var/www/html/pub/RHVH-4.0-20170308.0-RHVH-x86_64-dvd1.iso ... Extracting redhat-virtualization-host-image-update ... ./usr/share/redhat-virtualization-host/image ./usr/share/redhat-virtualization-host/image/redhat-virtualization-host-4.0-20170307.1.el7_3.squashfs.img ./usr/share/redhat-virtualization-host/image/redhat-virtualization-host-4.0-20170307.1.el7_3.squashfs.img.meta 1169874 blocks OK Copying squash.img to public directory . Available as http://sat62.lab.local/pub/RHVH-4.0-20170308.0-RHVH-x86_64-dvd1.iso/squashfs.img ... Copying /mnt/RHVH-4.0-20170308.0-RHVH-x86_64-dvd1.iso/images/pxeboot/vmlinuz /mnt/RHVH-4.0-20170308.0-RHVH-x86_64-dvd1.iso/images/pxeboot/initrd.img to /varlib/tftpboot/RHVH-4.0-20170308.0-RHVH-x86_64-dvd1.iso ... OK Unmounting /mnt/RHVH-4.0-20170308.0-RHVH-x86_64-dvd1.iso
Create Installation media
RHVH Installation media
http://fake.url
This is not used as it the kickstart will use a liveimg
url, not a media
url;
however Satellite is stubborn and still requires it.
Create partition table
name : RHVH Kickstart default
<%# kind: ptable name: Kickstart default %> zerombr clearpart --all --initlabel autopart --type=thinp
Create pxelinux for RHV
Based on Kickstart default PXELinux
```erb <%# kind: PXELinux name: RHVH Kickstart default PXELinux %> # # This file was deployed via '<%= @template_name %>' template # # Supported host/hostgroup parameters: # # blacklist = module1, module2 # Blacklisted kernel modules # <% options = [] if @host.params['blacklist'] options << "modprobe.blacklist=" + @host.params['blacklist'].gsub(' ', '') end options = options.join(' ') -%> DEFAULT rhvh LABEL rhvh KERNEL <%= @host.params["rhvh_image"] %>/vmlinuz <%= @kernel %> APPEND initrd=<%= @host.params["rhvh_image"] %>/initrd.img inst.stage2=http://<%= @host.hostgroup.subnet.tftp.name %>/pub/<%= @host.params["rhvh_image"] %>/ ks=<%= foreman_url('provision') %> intel_iommu=on ssh_pwauth=1 local_boot_trigger=<%= foreman_url("built") %> <%= options %> IPAPPEND 2 ```
Create Kickstart for RHV
File under Satellite Kickstart Default for RHVH
.
Note that the @host.hostgroup.subnet.tftp.name
variable is used to point to
the capsule associated to this host, rather than the Satellite server itself.
<%# kind: provision name: Satellite Kickstart default %> <% rhel_compatible = @host.operatingsystem.family == 'Redhat' && @host.operatingsystem.name != 'Fedora' os_major = @host.operatingsystem.major.to_i # safemode renderer does not support unary negation pm_set = @host.puppetmaster.empty? ? false : true puppet_enabled = pm_set || @host.params['force-puppet'] salt_enabled = @host.params['salt_master'] ? true : false section_end = (rhel_compatible && os_major <= 5) ? '' : '%end' %> install # not required # url --url=http://<%= @host.hostgroup.subnet.tftp.name %>/pub/<%= @host.params["rhvh_image"] %> lang en_US.UTF-8 selinux --enforcing keyboard es skipx <% subnet = @host.subnet -%> <% if subnet.respond_to?(:dhcp_boot_mode?) -%> <% dhcp = subnet.dhcp_boot_mode? && !@static -%> <% else -%> <% dhcp = !@static -%> <% end -%> network --bootproto <%= dhcp ? 'dhcp' : "static --ip=#{@host.ip} --netmask=#{subnet.mask} --gateway=#{subnet.gateway} --nameserver=#{[subnet.dns_primary, subnet.dns_secondary].select(&:present?).join(',')}" %> --hostname <%= @host %><%= os_major >= 6 ? " --device=#{@host.mac}" : '' -%> rootpw --iscrypted <%= root_pass %> firewall --<%= os_major >= 6 ? 'service=' : '' %>ssh authconfig --useshadow --passalgo=sha256 --kickstart timezone --utc <%= @host.params['time-zone'] || 'UTC' %> <% if @host.operatingsystem.name == 'Fedora' and os_major <= 16 -%> # Bootloader exception for Fedora 16: bootloader --append="nofb quiet splash=quiet <%=ks_console%>" <%= grub_pass %> part biosboot --fstype=biosboot --size=1 <% else -%> bootloader --location=mbr --append="nofb quiet splash=quiet" <%= grub_pass %> <% end -%> <% if @dynamic -%> %include /tmp/diskpart.cfg <% else -%> <%= @host.diskLayout %> <% end -%> text reboot liveimg --url=http://<%= foreman_server_fqdn %>/pub/<%= @host.params["rhvh_image"] %>/squashfs.img %post --nochroot exec < /dev/tty3 > /dev/tty3 #changing to VT 3 so that we can see whats going on.... /usr/bin/chvt 3 ( cp -va /etc/resolv.conf /mnt/sysimage/etc/resolv.conf /usr/bin/chvt 1 ) 2>&1 | tee /mnt/sysimage/root/install.postnochroot.log <%= section_end -%> %post logger "Starting anaconda <%= @host %> postinstall" nodectl init exec < /dev/tty3 > /dev/tty3 #changing to VT 3 so that we can see whats going on.... /usr/bin/chvt 3 ( <% if subnet.respond_to?(:dhcp_boot_mode?) -%> <%= snippet 'kickstart_networking_setup' %> <% end -%> #update local time echo "updating system time" /usr/sbin/ntpdate -sub <%= @host.params['ntp-server'] || '0.fedora.pool.ntp.org' %> /usr/sbin/hwclock --systohc <%= snippet "subscription_manager_registration" %> <% if @host.info['parameters']['realm'] && @host.realm && @host.realm.realm_type == 'Red Hat Identity Management' -%> <%= snippet "idm_register" %> <% end -%> # update all the base packages from the updates repository #yum -t -y -e 0 update <%= snippet('remote_execution_ssh_keys') %> sync <% if @provisioning_type == nil || @provisioning_type == 'host' -%> # Inform the build system that we are done. echo "Informing Foreman that we are built" wget -q -O /dev/null --no-check-certificate <%= foreman_url %> <% end -%> ) 2>&1 | tee /root/install.post.log exit 0 <%= section_end -%>
Create new Operating system
- Name: RHVH
- Major Version: 7
- Partition table: RHVH Kickstart default
- Installation media: RHVH Installation media
- Templates: "Kickstart default PXELinux for RHVH" and "Satellite kickstart default for RHVH"
Associate the previously-created provisioning templates with this OS.
Create a new hostgroup
Create a new host-group with a Global Parameter called rhvh_image
. This parameter
is used by the provisioning templates to generate the installation media paths as required.
eg:
rhvh_image = RHVH-4.0-20170308.0-RHVH-x86_64-dvd1.iso
rhviso2media
Final thoughts
Future Satellite versions of satellite might include better integration of RHV-H provisioning; however the method described above can be used in the meantime.
Happy hacking!