Inscreva-se no feed

table { border: #ddd solid 1px; } td, th { padding: 8px; border: #ddd solid 1px; } td p { font-size: 15px !important; }

In this post, continuing our series on setting up Red Hat Satellite for VMware to provision virtual machines (VMs) from Satellite, we'll look at creating templates for use with VMware.

Create VM Template on VMware

We will now create a VM template on VMware which we will use when provisioning RHEL VMs from Satellite. We will create a RHEL 8.3 template for the exercise which prepares us for a future tutorial where we update our RHEL VM via Satellite.

First you will need to upload any RHEL ISO files to the VMware environment you will need for the RHEL VM we will be creating. For RHEL 8.3 I uploaded the rhel-8.3-x86_64-dvd.iso file.

Create and start the RHEL VM. Choose 1 CPU with 2 GB of RAM and 20GB disk space. You will use the web console to interact with the VM and configure it. You will need to set the language, define the disk and set the root password. Start the installation and reboot the system per the installation instruction. After the system has rebooted, login as root and start a terminal session for the remainder of the configuration.

Check to see if the the ethernet connection is active and if not active, run the connect command

# nmcli device status
# nmcli device connect ens192
# nmcli device show ens192

We will temporarily configure the network device as we will need a network connection during the setup of the template

[root@localhost ~]# nmcli con modify ens192 ens192
[root@localhost ~]# nmcli con mod ens192 ipv4.method auto
[root@localhost ~]# nmcli con edit ens192
nmcli> remove ipv4.dns
nmcli> set ipv4.ignore-auto-dns yes
nmcli> set ipv4.dns
nmcli> save
nmcli> quit
[root@localhost ~]# nmcli device reapply ens192
[root@localhost ~]# nmcli device show ens192
[root@localhost ~]# hostnamectl set-hostname "localhost.localdomain"

We will now need to temporarily subscribe to Satellite to access template packages. Note: Here for the--org parameter we use the Operations Department (operations) label.

# rpm -ivh
# subscription-manager register --org=operations --activationkey=ak-ops-rhel8-prem-server 

To support the creation of the VM template, we will install the following the cloud-init, open-vm-tools and perl packages.

# yum -y install cloud-init open-vm-tools perl

Enable the CA certificates for the image.

# update-ca-trust enable 

Download the katello-server-ca.crt file from Satellite Server.

# wget -O /etc/pki/ca-trust/source/anchors/cloud-init-ca.crt

To update the record of certificates, enter the following command.

# update-ca-trust extract

Configure cloud-init to skip networking.
# cat << EOF > /etc/cloud/cloud.cfg.d/01_network.cfg
  config: disabled

We set up the cloud-init to make a call back to Satellite.

# cat << EOF > /etc/cloud/cloud.cfg.d/10_foreman.cfg
datasource_list: [NoCloud]

Make up a backup of the default cloud-init file.

# cp /etc/cloud/cloud.cfg ~/cloud.cfg.`date -I`

Replace the default cloud-init file.

# cat << EOF > /etc/cloud/cloud.cfg
 - bootcmd

 - runcmd

 - scripts-per-once
 - scripts-per-boot
 - scripts-per-instance
 - scripts-user
 - phone-home

  distro: rhel
    cloud_dir: /var/lib/cloud
    templates_dir: /etc/cloud/templates
  ssh_svcname: sshd

# vim:syntax=yaml

We will now unregister the server from Satellite

# subscription-manager unregister
Unregistering from:
System has been unregistered.
# subscription-manager clean
All local data removed

We will create a clean up script. Remember to hit Ctrl-D after the cat command or just copy and paste the content here (minus the cat command line) into a file named

# cat > ~/ <<EOF

# stop logging services
/usr/bin/systemctl stop rsyslog
/usr/bin/service stop auditd

# remove old kernels
# /bin/package-cleanup -oldkernels -count=1

#clean yum cache
/usr/bin/yum clean all

#force logrotate to shrink logspace and remove old logs as well as truncate logs
/usr/sbin/logrotate -f /etc/logrotate.conf
/bin/rm -f /var/log/*-???????? /var/log/*.gz
/bin/rm -f /var/log/dmesg.old
/bin/rm -rf /var/log/anaconda
/bin/cat /dev/null > /var/log/audit/audit.log
/bin/cat /dev/null > /var/log/wtmp
/bin/cat /dev/null > /var/log/lastlog
/bin/cat /dev/null > /var/log/grubby

#remove udev hardware rules
/bin/rm -f /etc/udev/rules.d/70*

#remove uuid from ifcfg scripts
/bin/cat > /etc/sysconfig/network-scripts/ifcfg-ens192 <<EOM

#remove SSH host keys
/bin/rm -f /etc/ssh/*key*

#remove root users shell history
/bin/rm -f ~root/.bash_history

#remove root users SSH history
/bin/rm -rf ~root/.ssh/known_hosts

Run the clean script.

sh ~/

Finally we will power off the system to make the VMware template.

# systemctl poweroff

Now we will return to the the vCenter console and convert the VM to a template. Name the template template-rhel8-cloudinit.

Back on the Satellite side...

First we will define RHEL 8.3 as an operating system choice. Make sure you are in the Operations Department organization and the moline locations. On the side menu choose Hosts -> Operating Systems. 

On the Operating Systems page click the blue Create Operating System button.

On the Operating Systems > Create Operating Systems page fill in or choose options from the following table, and click the blue Submit button. We will only be filling in information on the Operating System tab and accept the default settings for any other tabs on this page. We will revisit this page in a few minutes to update the template tab. After filling in the information, click the blue Submit button.





Major Version*


Minor Version







Next we will create a cloud-init template. Login into Satellite server's command line and switch to root user. In the root user's home direct create the following cloud-init template. Note: The cloud-init template we are creating will also register your RHEL VM to Satellite and Insights.

# cat > ~/vmware-cloud-init-template.erb <<EOF
hostname: <%= %>
fqdn: <%= @host %>
manage_etc_hosts: true
users: {}
- touch ~/cloud-init

- |
<%= indent(2) { snippet 'redhat_register' } -%>
- |
<%= indent(2) { snippet 'insights' } -%>
- |

  url: <%= foreman_url('built') %>
  post: []
tries: 10

From Hammer, let's get the ids for the operating system, architecture, and compute resources.

$ hammer os list; hammer architecture list; hammer compute-resource list
1  | RedHat 7.9 |              | Redhat
2  | RedHat 8.3 |              | Redhat
1  | x86_64
2  | i386  
4  | cr-vcenter | VMware  

Now we will create our cloud-init template on Satellite.

# hammer template create --name vmware-cloud-init --file ~/vmware-cloud-init-template.erb --locations moline --organizations "Operations Department" --operatingsystem-ids 2 --type cloud-init
Provisioning template created.

For the user data we can use the UserData open-vm-tools template that is provided with Satellite. We will need to associate the UserData open-vm-tools template with RHEL 8.3. Chose Hosts -> Provisioning Templates from the side menu.

On the Provisioning Templates page, type userdata in the search field and the click Search button. On the resulting list, click on the UserData open-vm-tools link.

On the Provisioning Templates > Edit UserData open-vm-tools page click the Association tab. Next click RedHat 8.3 in the Applicable Operating Systems section All Items list and it will move over to the Selected Items list. Click the blue Submit button.


Creat an image in Satellite link the vCenter template

# hammer compute-resource image create --operatingsystem-id 2 --architecture-id 1 --compute-resource-id 4 --user-data true --uuid template-rhel8-cloudinit --username root --name img-rhel8-prem-server
Image created.

Let's update the RHEL 8.3 Operating System to use the correct templates for our deployment.

Make sure you are in the Operations Department organization and the moline locations. On the side menu choose Hosts -> Operating Systems.


Now click on the RedHat 8.3 Link.


On the Operating Systems > Editing RedHat 8.3 page, click on the Templates tab. Chose following options from the appropriate dropdown list. When you are finished click the blue Submit button.

Option Name


Cloud-init template


User data template

UserData open-vm-tools


We are finished here.

I would also recommend checking to see if the VM we created for our template on vSphere has been removed from Satellite. If not, we will want to delete it. First make sure you have set organization to Any Organization and location to Any Location. From the side menu choose Hosts -> All Hosts.

Click on the Edit drop down button in the far right column for the localhost.localdomain host, and choose Delete.


In the dialog box that says "Are you sure you want to delete host localhost.localdomain? This action is irreversible.", click the OK button.

Be sure to see the previous post in this series, "How to prepare Red Hat Satellite for VMWare integration," and the rest. We'll be back next week with the next steps!


Provisioning RHEL virtual machines to vSphere from Red Hat Satellite

Isometric thumbnail image, abstract In this multi-part tutorial, we cover how to provision Red Hat Enterprise Linux (RHEL) virtual machines (VMs) to a vSphere environment from Red Hat Satellite. Missed any steps in the series? Check them out:


Sobre o autor

Paul Lucas is a Chicagoland-based Red Hat Solutions Architect working with a variety of enterprise businesses. A 21 year technical sales veteran, Paul was previously a customer working at a benefits consulting firm, where he advised development teams on the use of Java and the then-emerging Java EE.

Read full bio

Navegue por canal

automation icon


Últimas novidades em automação de TI para empresas de tecnologia, equipes e ambientes

AI icon

Inteligência artificial

Descubra as atualizações nas plataformas que proporcionam aos clientes executar suas cargas de trabalho de IA em qualquer ambiente

open hybrid cloud icon

Nuvem híbrida aberta

Veja como construímos um futuro mais flexível com a nuvem híbrida

security icon


Veja as últimas novidades sobre como reduzimos riscos em ambientes e tecnologias

edge icon

Edge computing

Saiba quais são as atualizações nas plataformas que simplificam as operações na borda

Infrastructure icon


Saiba o que há de mais recente na plataforma Linux empresarial líder mundial

application development icon


Conheça nossas soluções desenvolvidas para ajudar você a superar os desafios mais complexos de aplicações

Original series icon

Programas originais

Veja as histórias divertidas de criadores e líderes em tecnologia empresarial