Red Hat Training

A Red Hat training course is available for Red Hat Satellite

Chapter 6. Provisioning Bare Metal Hosts

In this chapter, we explore four main ways to provision bare metal instances with Red Hat Satellite 6. These include:

  • Unattended Provisioning - You identify a host using a MAC address and the Satellite Server provisions it using a PXE boot process.
  • Unattended Provisioning with Discovery - New hosts use PXE boot to load the Satellite Discovery service. This service identifies hardware information about the host and lists it as an available host to provision.
  • PXE-less Provisioning - The ability to provision new hosts using a boot disk or PXE-less discovery image that the Satellite Server generates.
  • PXE-less Provisioning with Discovery - New hosts use an ISO boot disk that loads the Satellite Discovery service. This service identifies hardware information about the host and lists it as an available host to provision.
Note

Previous versions of Red Hat Satellite provided the use of a host group-based template rendering feature during provisioning. This feature allowed users to render templates for a host group instead of a single host. This feature is not supported for Red Hat Satellite 6.2 due to certain limitations such as a lack of host records or audit trail. It is recommended to use Discovery features, which provide similar functionality.

6.1. Defining Requirements for Bare Metal Provisioning

The requirements for bare metal provisioning include:

  • Synchronized content repositories for Red Hat Enterprise Linux 7. See Synchronizing Red Hat Repositories in the Red Hat Satellite 6 Content Management Guide for more information.
  • A Capsule Server managing the network for bare metal hosts. For unattended provisioning and discovery-based provisioning, the Satellite Server requires PXE server settings. See Chapter 4, Configuring Networking for more information.
  • An example activation key for host registration. See Section 3.6, “Creating an Activation Key” for more information.
  • A blank bare metal host for testing purposes.

6.2. Creating New Hosts with Unattended Provisioning

Unattended provisioning is the simplest form of host provisioning. This method requires you to enter the host details on the Satellite Server and boot your host. The Satellite Server automatically manages the PXE configuration, organizes networking services, and provides the operating system and configuration for the host. This method of provisioning hosts uses minimal interaction during the process.

This scenario demonstrates how to provision a host on ACME’s private network. In this example, the bare metal host connects to ACME’s private network at 192.168.140.0/24 and uses an interface with aa:aa:aa:aa:aa:aa as the MAC address.

For Web UI Users

Navigate to Hosts > New host. The UI provides a set of fields where you can input details for the host.

  • In the Host tab:

    • Enter the Name of the host. This becomes the provisioned system’s host name. For this example, enter baremetal-test1.
    • The provisioning context (Organization and Location) automatically sets to ACME and New York.
    • Select Base from the Host Group field. This should automatically populate most of the new host’s fields.
  • In the Interface tab:

    • Click Edit on the host’s interface.
    • Most of the fields should automatically contain values. Note in particular:

      • The Name from the Host tab becomes the DNS name.
      • The Satellite Server automatically assigns an IP address for the new host.
    • Enter the MAC address for the host. In this example, the MAC address is aa:aa:aa:aa:aa:aa. This is important as it ensures the identification of the host during the PXE boot process.
    • The Satellite Server should automatically select the Managed, Primary, and Provision options for the first interface on the host. If not, select them.
  • In the Operating System tab:

    • All fields should automatically contain values. Confirm each aspect of the operating system.
    • Click Resolve in Provisioning template to check the new host can identify the right provisioning templates to use. This should include:

  • In the Parameters tab:

    • Confirm the kt_activation_keys parameter exists and is using the example activation key.

Click Submit.

For CLI Users

Create the host with the hammer host create command. For example:

# hammer host create --name "baremetal-test1" --organization "ACME" \
--location "New York" --hostgroup "Base" --mac "aa:aa:aa:aa:aa:aa" \
--build true --enabled true --managed true

Ensure our network interface options are set using the hammer host interface update command. For example:

# hammer host interface update --host "test1" --managed true \
--primary true --provision true

This creates the host entry and the relevant provisioning settings. This also includes creating the necessary directories and files for PXE booting the bare metal host. If you power the physical host and set its boot mode to PXE, the host detects the DHCP service of the Satellite Server’s integrated Capsule and starts installing Red Hat Enterprise Linux 7.2 from its kickstart tree. When installation completes, the host also registers to the Satellite Server using the example activation key and installs the necessary configuration and management tools from the Red Hat Satellite Tools repository.

6.3. Configuring Red Hat Satellite’s Discovery Service

Red Hat Satellite provides a Discovery feature. This provides a method to automatically detect blank hosts on a network. These hosts boot a special image that performs hardware detection and relays this information back to the Satellite Server. This provides a method to create a pool of ready-to-provision hosts on the Satellite Server and without needing to enter the MAC address of each host.

PXE mode

Installation

Before using the Discovery service, you must install the Discovery image and enable the Discovery plugin on the Satellite Server.

Enable the plugin using the --enable-foreman-plugin-discovery option with the satellite-installer command:

# satellite-installer --enable-foreman-plugin-discovery

This installs and enables the Discovery service plugin on the Satellite Server. After installation completes, install the following packages:

# yum install foreman-discovery-image rubygem-smart_proxy_discovery
  • The foreman-discovery-image package installs the Discovery ISO to the /usr/share/foreman-discovery-image/ directory and also creates a PXE boot image from this ISO using the livecd-iso-to-pxeboot tool. The tool saves this PXE boot image in the /var/lib/tftpboot/boot directory.
  • The rubygem-smart_proxy_discovery package configures a Capsule Server (such as the Satellite Server’s integrated Capsule) to act as a proxy for the Discovery service.

After installation completes, a new menu option appears in the Satellite Server’s Web UI under Hosts > Discovered hosts.

Enabling Discovery service on a Capsule Server

Complete the following procedure to enable the Discovery service on a Capsule Server.

  1. Run the following commands in order on the Capsule Server that you want:

    # yum install foreman-discovery-image rubygem-smart_proxy_discovery -y
    # katello-service restart
  2. Log in to the Satellite web UI, navigate to Infrastructure > Capsule.
  3. Click on the Capsule Server and click on the refresh button. The Capsule Server will have responded to the commands that you have run. If you look at the services configured, you will now see that discovery is listed. This means that the Discovery service is now running.

Provisioning Templates

The PXELinux global default template in the Hosts > Provisioning templates section includes an entry for the Discovery service.

LABEL discovery
   MENU LABEL (discovery)
   KERNEL boot/fdi-image-rhel_7-vmlinuz
   APPEND initrd=boot/fdi-image-rhel_7-img rootflags=loop root=live:/fdi.iso rootfstype=auto ro rd.live.image acpi=force rd.luks=0 rd.md=0 rd.dm=0 rd.lvm=0 rd.bootif=0 rd.neednet=0 nomodeset proxy.url=https://SATELLITE_CAPSULE_URL:9090 proxy.type=proxy
   IPAPPEND 2

The KERNEL and APPEND options boot the Discovery image and ramdisk. Also note the APPEND option contains a proxy.url parameter, which specifies the URL of the Capsule Server to use for provisioning. Edit the SATELLITE_CAPSULE_URL to the name of the provisioning capsule that you want. In this scenario, it is the Satellite Server’s integrated Capsule:

proxy.url=https://satellite.example.com:9090
Note

You can change the Discovery service to be the default service that boots for blank hosts. Edit the ONTIMEOUT value in the PXELinux global default to the following

ONTIMEOUT discovery

You need to push the changes from the PXELinux global default template to the Satellite Server’s default PXE template. Navigate to Hosts > Provisioning templates and click Build PXE Default. This refreshes the default PXE template on the Satellite Server.

Subnets

All subnets with discoverable hosts require an appropriate Capsule Server selected to provide the Discovery service. To do this, navigate to Infrastructure > Capsules and verify if the Capsule Server that you want to use lists the Discovery feature. If not, click Refresh features and it appears immediately.

Navigate to Infrastructure > Subnets, select a subnet, click the Capsules tab, and select the Discovery Proxy that you want to use. Perform this for each appropriate subnet.

Testing

Test the Discovery service and boot a blank bare metal host on the 192.168.140.0/24 network. A boot menu displays and shows two options:

  • (local), which boots from the hard disk
  • (discovery), which boots to the Discovery service

Select (discovery) to boot the Discovery image. After a few minutes, the Discovery image completes booting and shows a status screen.

Navigate to Hosts > Discovered hosts and the list includes the newly discovered host. The discovered hosts automatically define their host name based on their MAC address. For example, Satellite sets a discovered host with a MAC address of ab:cd:ef:12:34:56 to have macabcdef123456 as the host name. You can change this host name when provisioning the host.

Note

The Satellite Server assigns organization and location to discovered hosts according to the following rules from top to bottom:

  • Setting the discovery_organization or discovery_location, if present. These can be set under Administer > Settings > Discovered.
  • Setting foreman_organization or foreman_location facts for a host. The fact names that are looked up can be configured in Administer > Settings > Puppet section as the Organization and Location fact setting.
  • If a discovered host uses a subnet defined in Satellite, use the first organization and location associated with the subnet.
  • Select the first Organization and Location ordered by name.

Organization or Location can be changed using the bulk actions menu of the Discovered hosts page. Select the discovered hosts to modify and select Assign Organization or Assign Location from the Select Action menu.

6.4. Creating New Hosts from Discovered Hosts

Provisioning discovered hosts follows the same basic provisioning process. The difference is we identify the host to provision from the list of discovered hosts instead of manually entering the host’s MAC address.

For Web UI Users

Navigate to Hosts > Discovered host. This displays a list of ACME’s discovered hosts. Select one and click Provision on the right side of the list. The UI provides a set of fields where you can input details for the host.

  • In the Host tab:

    • Enter a new Name of the Host. This becomes the provisioned system’s host name. For this example, enter baremetal-test2.
    • The provisioning context (Organization and Location) should automatically set to ACME and New York.
    • Select Base from the Host Group field. This should automatically populate most of the new host’s fields.
  • In the Interface tab:

    • Click Edit on the host’s interface.
    • Most of the fields should automatically contain values. Note in particular:

      • The Name from the Host tab becomes the DNS name.
      • The Satellite Server automatically assigns an IP address for the new host.
      • The Satellite Server automatically populates the MAC address from the Discovery results.
    • Confirm these details.
    • The Satellite Server should automatically select the Managed, Primary, and Provision options for this host. If not, select them.
  • In the Operating System tab:

    • All fields should automatically contain values. Confirm each aspect of the operating system.
    • Click Resolve in Provisioning template to check the new host can identify the right provisioning templates to use. This should include:

      • PXELinux Template: Kickstart default PXELinux
      • provision Template: Satellite Kickstart Default

    For instructions on associating provisioning templates, see Section 3.3, “Creating Provisioning Templates”.

  • In the Parameters tab:

    • Confirm the kt_activation_keys parameter exists and is using the example activation key.

Click Submit.

For CLI Users

Identify the discovered host to use for provisioning:

# hammer discovery list

Select a host and provision it using the Base host group. Set a new host name with the --new-name options:

# hammer host create --name "macaaaaaaaaaaaa" \
--new-name "baremetal-test2" --organization "ACME" \
--location "New York" --hostgroup "Base" --build true \
--enabled true --managed true

This removes the host from the discovered host listing and creates a host entry with the relevant provisioning settings. The Discovery image automatically resets the host so that it can boot to PXE. The host detects the DHCP service on the Satellite Server’s Integrated Capsule and starts installing Red Hat Enterprise Linux 7.2 from its kickstart tree. When installation completes, the host also registers to the Satellite Server using the example activation key and installs the necessary configuration and management tools from the Red Hat Satellite Tools repository.

6.5. Creating Discovery Rules

As a method of automating the provisioning process for discovered hosts, Red Hat Satellite 6 provides a feature to create discovery rules. These rules define how discovered hosts automatically provision themselves, based on the assigned host group. For example, you might aim to automatically provision hosts with a high CPU count as hypervisors. Likewise, you might aim to provision hosts with large hard disks as storage servers.

Note

Auto provisioning does not currently allow configuring NICs; all systems are being provisioned with the NIC configuration that was detected during discovery. However, NIC can be set in an Anaconda kickstart, scriptlet, or via configuration management later on.

For Web UI Users

To create a rule, navigate to Configure > Discovery rules. This displays a list of existing rules. Select New Rule and the UI provides a set of fields for the rule details:

  • Name - A plain text name to represent the rule. For example: Hypervisor
  • Search - Defines the rules to use to determine whether to provision a host. This field provides suggestions for values you enter and allows operators for multiple rules. For example: cpu_count > 8
  • Host Group - Defines the host group to use.
  • Hostname - Defines a pattern for determining host names for multiple hosts. This uses the same ERB syntax that provisioning templates use. The host name can use the @host attribute for host-specific values and the rand function for a random number. For example:

    • myhost-<%= rand(99999) %>
    • abc-<%= @host.facts['bios_vendor'] + '-' + rand(99999) %>
    • xyz-<%= @host.hostgroup.name %>
    • srv-<%= @host.discovery_rule.name %>
    • server-<%= @host.ip.gsub('.','-') + '-' + @host.hostgroup.subnet.name %>

    When creating host name patterns, make sure the resulting host names are unique. Hostnames must not start with numbers. A good approach is to use unique information provided by Facter, such as the MAC address, BIOS, or serial ID.

  • Hosts limit - The maximum hosts you can provision with the rule. Use 0 for unlimited.
  • Priority - Defines the precedence a rule has over other rules. Rules with lower values have a higher priority.
  • Enabled - Defines whether the rule is currently in action or not.

The Satellite Server uses current provisioning context for the rule. You can choose additional contexts from the Organizations and Locations tabs.

Click Submit to save your rule.

Navigate to Hosts > Discovered host and select either:

  • Auto-Provision from a discovered host’s menu on the right. This automatically provisions a single host.
  • Auto-Provision All from the top-right of the table. This automatically provisions all hosts.

For CLI Users

Create the rule with the hammer discovery_rule create command:

# hammer discovery_rule create --name "Hypervisor" \
--search "cpu_count  > 8" --hostgroup "Base" \
--hostname "hypervisor-<%= rand(99999) %>" \
--hosts-limit 5 --priority 5 --enabled true

Automatically provision a host with the hammer discovery auto-provision command:

# hammer discovery auto-provision --name "macabcdef123456"

6.6. Creating New Hosts with PXE-less Provisioning

Some hardware does not provide a PXE boot interface. However, it is possible to provision a new host in Red Hat Satellite 6 without the need for PXE boot. This involves generating a boot ISO that hosts can use. This ISO enables the host to connect to the Satellite Server, boot the installation media, and install the operating system. The process for creating a boot ISO for a host follows the same basic provisioning process. The difference is you generate an ISO file from the new host entry.

For Web UI Users

Navigate to Hosts > New host. The UI provides a set of fields where you can input details for the host.

  • In the Host tab:

    • Enter the Name of the Host. This becomes the provisioned system’s host name. For this example, enter baremetal-test3.
    • The provisioning context (Organization and Location) should automatically set to ACME and New York.
    • Select Base from the Host Group field. This should automatically populate most of the new host’s fields.
  • In the Interface tab:

    • Click Edit on the host’s interface.
    • Most of the fields should automatically contain values. Note in particular:

      • The Name from the Host tab becomes the DNS name.
      • The Satellite Server automatically assigns an IP address for the new host.
    • Enter the MAC address for the host. In this example, the MAC address is aa:aa:aa:aa:aa:aa.
    • The Satellite Server should automatically select the Managed, Primary, and Provision options for this host. If not, select them.
  • In the Operating System tab:

    • All fields should automatically contain values. Confirm each aspect of the operating system.
    • Click Resolve in Provisioning template to check the new host can identify the right provisioning templates to use. This should include:

      • bootdisk Template: Boot disk iPXE - host
      • kexec Template: Discovery Red Hat kexec
      • provision Template: Satellite Kickstart Default

    For instructions on associating provisioning templates, see Section 3.3, “Creating Provisioning Templates”.

  • In the Parameters tab:

    • Confirm the kt_activation_keys parameter exists and is using the example activation key.

Click Submit.

This creates a host entry and the host details page appears. The options on the top-right of the page show a Boot disk menu, which provides:

  • Host image - A boot ISO for the specific host. This only contains the boot files necessary to access the installation media on the Satellite Server.
  • Full host image - A boot ISO containing the kernel and initial RAM disk image for the specific host.
  • Generic image - A boot ISO not tied to any specific host. In this situation, the ISO sends the host’s MAC address to the Satellite Server, which matches it against the host entry. This image is also available from the /bootdisk/disks/generic URL on your Satellite Server. For example, https://satellite.example.com/bootdisk/disks/generic.
  • Subnet image - A generic boot ISO that communicates through a Capsule Server.
Note

The Full host image is based on SYSLINUX and works with most hardware. When using an iPXE-based boot disk (Host image, Generic image, or Subnet image), see http://ipxe.org/appnote/hardware_drivers for a list of hardware drivers expected to work with an iPXE-based boot disk.

For CLI Users

Create the host with the hammer host create command. For example:

# hammer host create --name "baremetal-test3" --organization "ACME" \
--location "New York" --hostgroup "Base" --mac "aa:aa:aa:aa:aa:aa" \
--build true --enabled true --managed true

Ensure our network interface options are set using the hammer host interface update command. For example:

# hammer host interface update --host "test3" --managed true \
--primary true --provision true

Download the boot disk from Satellite Server with the hammer bootdisk host command:

# hammer bootdisk host --host test3.example.com

Use the --full option to download the full host image.

# hammer bootdisk host --host test3.example.com --full true

Download the generic image with the hammer bootdisk generic command:

# hammer bootdisk generic

This creates a boot ISO for your host to use. If you power the physical host and boot from the ISO, the host connects to the Satellite Server and starts installing Red Hat Enterprise Linux 7.2 from its kickstart tree. When installation completes, the host also registers to the Satellite Server using the example activation key and installs the necessary configuration and management tools from the Red Hat Satellite Tools repository.

6.7. Implementing PXE-less Discovery

Red Hat Satellite 6 also provides a PXE-less Discovery service that operates without the need for PXE-based services (DHCP and TFTP). You accomplish this using the Satellite Server’s Discovery image.

PXEless mode

If you have not yet installed the Discovery service or image, follow the "Installation" section in Section 6.3, “Configuring Red Hat Satellite’s Discovery Service”.

The ISO for the Discovery service resides at /usr/share/foreman-discovery-image/ and is installed using the foreman-discover-image package.

Attended Use

This ISO acts as bootable media. Copy this media to either a CD, DVD, or a USB stick. For example, to copy to a USB stick at /dev/sdb:

# dd bs=4M \
if=/usr/share/foreman-discovery-image/foreman-discovery-image-3.1.1-10.iso \
of=/dev/sdb

Insert the Discovery boot media into a bare metal host, start the host, and boot from the media. The Discovery Image displays an option for either Manual network setup or Discovery with DHCP:

  • If selecting Manual network setup, the Discovery image requests a set of network options. This includes the primary network interface that connects to the Satellite Server. This Discovery image also asks for network interface configuration options, such as an IPv4 Address, IPv4 Gateway, and an IPv4 DNS server. As an example, ACME might use the following details:

    • IPv4 Address: 192.168.140.20
    • IPv4 Gateway: 192.168.140.1
    • IPv4 DNS: 192.168.140.2 (The Satellite Server’s integrated Capsule)

      After entering these details, select Next.

  • If selecting Discovery with DHCP, the Discovery image requests only the primary network interface that connects to the Satellite Server. It attempts to automatically configure the network interface using a DHCP server, such as one that a Capsule Server provides.

After the primary interface configuration, the Discovery image requests the Server URL, which is the URL of the Satellite Server or Capsule Server offering the Discovery service. For example, to use the integrated Capsule on ACME’s Satellite Server, use the following URL:

https://satellite.example.com:9090

And set the Connection type to Proxy. When ready, select Next.

The Discovery image also provides a set of fields to input Custom facts for the Facter tool to relay back to the Satellite Server. These are entered in a name-value format. Provide any custom facts you require and select Confirm to continue.

The Satellite reports a successful communication with the Satellite Server’s Discovery service. Navigate to Hosts > Discovered hosts and the list includes the newly discovered host.

To provision discovered hosts, see Section 6.4, “Creating New Hosts from Discovered Hosts”.

Unattended Use and Customization

It is possible to create a customized Discovery ISO, which automates the process of configuring the image after booting. The Discovery image uses a Linux kernel for the operating system, which means you pass kernel parameters to the configure the image’s operating system. These kernel parameters include:

proxy.url
The URL of the Capsule Server providing the Discovery service.
proxy.type
The proxy type. This is usually set to proxy to connect to the Capsule Server. This parameter also supports a legacy foreman option, where communication goes directly to the Satellite Server instead of a Capsule Server.
fdi.pxmac
The MAC address of the primary interface in the format of AA:BB:CC:DD:EE:FF. This is the interface you aim to use for communicating with the Capsule Server. In automated mode, the first NIC (using network identifiers in alphabetical order) with a link is used. In semi-automated mode, a screen appears and requests you to select the correct interface.
fdi.pxip, fdi.pxgw, fdi.pxdns
Manually configures IP address (fdi.pxip), the gateway (fdi.pxgw), and the DNS (fdi.pxdns) for the primary network interface. If your omit these parameters, the image uses DHCP to configure the network interface.
fdi.pxfactname1, fdi.pxfactname2 …​ fdi.pxfactnameN
Allows you to specify custom fact names.
fdi.pxfactvalue1, fdi.pxfactvalue2 …​ fdi.pxfactvalueN
The values for each custom fact. Each value corresponds to a fact name. For example, fdi.pxfactvalue1 sets the value for the fact named with fdi.pxfactname1.
fdi.pxauto
Defines whether to use automatic or semi-automatic mode. If set to 0, the image uses semi-automatic mode, which allows you to confirm your choices through a set of dialog options. If set to 1, the image uses automatic mode and proceeds without any confirmation.

The Satellite Server also provides a tool (discovery-remaster) in the foreman-discovery-image package. This tool remasters the image to include these kernel parameters. To remaster the image, run the discovery-remaster tool. For example:

# discovery-remaster ~/iso/foreman-discovery-image-3.1.1-10.iso \
"fdi.pxip=192.168.140.20/24 fdi.pxgw=192.168.140.1 \
fdi.pxdns=192.168.140.2 proxy.url=https://satellite.example.com:9090 \
proxy.type=proxy fdi.pxfactname1=customhostname \
fdi.pxfactvalue1=myhost fdi.pxmac=52:54:00:be:8e:8c fdi.pxauto=1"

The tool creates a new ISO file in the same directory as the original discovery image. In this scenario, it saves under /usr/share/foreman-discovery-image/.

Copy this media to either a CD, DVD, or a USB stick. For example, to copy to a USB stick at /dev/sdb:

# dd bs=4M \
if=/usr/share/foreman-discovery-image/foreman-discovery-image-3.1.1-10.iso \
of=/dev/sdb

Insert the Discovery boot media into a bare metal host, start the host, and boot from the media.

To provision discovered hosts, see Section 6.4, “Creating New Hosts from Discovered Hosts”.

Final Notes

The host needs to resolve to the following provisioning templates:

  • kexec Template: Discovery Red Hat kexec
  • provision Template: Satellite Kickstart Default

For instructions on associating provisioning templates, see Section 3.3, “Creating Provisioning Templates”.

6.8. Chapter Summary

This chapter explored bare metal host provisioning, which includes several different methods such as unattended provisioning, discovery-based provisioning, and PXE-less provisioning. You can use some of these same methods when provisioning hosts from virtualization infrastructure, such as Kernel-based Virtual Machine (KVM) servers, Red Hat Enterprise Virtualization, and VMware vSphere.

The next chapter explores methods of provisioning from a KVM server using libvirt virtualization.