Provisioning Bare Metal and VM from Foreman in 6 easy steps

Provisioning Bare-Metal from Foreman Provisioning Bare-Metal from Foreman

Configure Host Groups

To configure the host groups, navigate to

Configure –> Host Groups –> Click on “Provision from foreman.linuxsysadmins.local

If we select the appropriate options here, later in our host creation step it can be skipped. The hosts coming under this group will be applied with these configurations.

  1. This option already in place which created during the provisioning setup.
  2. Select the life Cycle environment to be used under the host group.
  3. The content view needs to be used for the group.
  4. This options will be in place by default.
  5. At last, the puppet environment needs to be used.

Jump to Operating System tab and select the required options as well. Most of the options are already in place.

  1. Select the operating System version (CentOS 7.8.2003) from the drop down list.
  2. Choose the media which need to be used for this host group.
  3. Pick the partition table.
  4. Select the PXE loader
  5. Finally, type the password. This could be a encrypted password using python script.
# python -c 'import crypt,getpass;pw=getpass.getpass(); print(crypt.crypt(pw)) if (pw==getpass.getpass("Confirm: ")) else exit()'

Creating Hosts

The last step of Provisioning bare metal is to create the hosts. To create one, navigate to

Hosts –> Create Host

Creating the same from CLI

# hammer host create --name "pve" --organization "LinuxSys Organization" \
--location "MyHomeLab" --hostgroup "Provision from foreman.linuxsysadmins.local" --mac "xx:xx:xx:xx:xx" \
--build true --enabled true --managed true

Host Details

Click on the Host tab and provide the name “pve3”. After that, once we select the Host group all the options will be auto-filled because we have configured those in our earlier step where we configured Host Group.

Selecting Operating System

Switch to Operating System tab to select the required OS versions.

  1. Select the Operating System as CentOS 7.8.2003
  2. To build the host by provisioning, we should select this option.
  3. Select the media as local
  4. Pick the Partition table for host
  5. Choose the PXE Loader as PXELinux BIOS.
  6. Finally, type the password or create an encrypted password using below python script.
# python -c 'import crypt,getpass;pw=getpass.getpass(); print(crypt.crypt(pw)) if (pw==getpass.getpass("Confirm: ")) else exit()'

To list all the available templates click resolve.

Configure Interface of Host

Enter the host details like Interface type and IP informations.

# hammer host interface update --host "pve3" --identifier "eno1" --ip "" --managed true --primary true --provision true

Doing the same from Graphical user interface.

  • Select the type of interface
  • Enter the MAC address of the host
  • Interface name on the host, example eth0 or eno1.
  • The IP address of the host and click Ok.

Will look like below once it configured.

Selecting the Hardware Model

Navigate to Additional information tab and select the correct Hardware mode.

Once all done, click Submit to create the Host. The status of the host should be now as “Pending Installation“.

Starting Provisioning

Let’s PowerON the physical host to start the provisioning. It should now start with PXE boot and assign the IP address.

By following we will get the Installer Boot screen. Hit Enter key or wait for 10 seconds.

The anaconda installer will start the installation. Refer below snip for more information.

Right after installing all the packages, Provisioning will install the EPEL repository package. This requires an internet connection on your host. If you have not configured with the proper gateway, DNS in earlier steps in this stage it will fail/skip the EPEL installation.

Once the EPEL installation completes the host will be rebooted and status on foreman will be Installed as shown below.

Additionally, we will get the notification in right side top corner.

Let’s try with Provisioning one more host.

Successfully completed with Provisioning.

Watching logs for Provisioning Status

To know the provisioning status from the log run the command

# foreman-tail

You should get the status as shown below.

==> /var/log/foreman/production.log <==
2020-05-16T20:01:30 [I|app|8fefcd5e] Started POST "/unattended/built?token=[FILTERED]" for at 2020-05-16 20:01:30 +0400
2020-05-16T20:01:30 [I|app|8fefcd5e] Processing by UnattendedController#built as TEXT
2020-05-16T20:01:30 [I|app|8fefcd5e]   Parameters: {"token"=>"[FILTERED]"}
2020-05-16T20:01:30 [I|app|8fefcd5e] unattended: pve4.linuxsysadmins.local is built!

After two successful provisionings, we should get the list of hosts as shown below.

That’s it, we have successfully completed with Provisioning Bare Metal.


To automate the physical or virtual server build we can use the OpenSource tool foreman. Setting up a provisioning bare metal set up with a host group will automate the group of hosts with the same version of Operating system and disk Partition structure. Will come up with custom partitioning and template in a future guide. Subscribe to our newsletter, Any query or document update required comment below the same in the comment section. Your valuable feedback is important to us.