15.3. Provisioning Discovered Hosts

After you have correctly configured Discovery plug-ins on both the Satellite Server and the Capsule, you can automatically detect bare-metal hosts. To do so, boot a machine in any provisioning network that was configured with the PXE configuration template described in Section 15.1.2, “Configuring PXE-booting”. The machine is automatically registered with the Satellite Server and appears in the HostsDiscovered Hosts list in the Satellite web UI.
You can either provision the discovered host manually, or you can configure automatic provisioning.

15.3.1. Manually Provisioning Hosts

The following procedure describes how to manually provision discovered hosts from the Satellite web UI.

Procedure 15.2. To Manually Provision a Discovered Host:

  1. Navigate to HostsDiscovered Hosts.
  2. Select the host you want to provision and click Provision.
  3. On the host's Edit page, complete the necessary details, and then click Save.
When the host configuration is saved, Satellite modifies the host's PXELinux file on the TFTP server and reboots the discovered host. It then boots into an installer for the chosen operating system, and finally into the installed operating system.
If you decide to re-provision an existing discovered host, delete the operating system from the machine and reboot it. The host then reappears on the Discovered Hosts page.

15.3.2. Decommissioning Discovered Hosts

If a host is no longer required to be managed by Red Hat Satellite, the host must be decommissioned according to the following procedure to prevent it from being discovered again.
  1. Shutdown the host.
  2. Navigate to HostsDiscovered Hosts.
  3. In the Name column find the host you want to decommission and then select Delete from the corresponding Edit drop-down menu.

15.3.3. Automatically Provisioning Hosts

With Satellite 6.1, it is possible to define provisioning rules that will assign a host group to provisioned hosts and trigger provisioning automatically.

Procedure 15.3. To Create a Provisioning Rule:

  1. Navigate to ConfigureDiscovery rules.
  2. Click New Rule. Specify the following parameters of the provisioning rule:
    • Name is the name of the rule displayed in the list of rules. This name must not contain spaces or non-alphanumeric characters.
    • Search is the search statement used to match discovered hosts for the particular rule. You can use scoped search syntax to define it. See Section 15.3.4, “Scoped Search Syntax” for examples of using scoped search.
    • Host Group is the host group to be assigned to a matching host before starting the provisioning process. Make sure that the selected host group has all the required parameters set; required parameters are marked with an asterisk (*).
    • Hostname defines a pattern for assigning human-readable host names to the matching hosts. When left blank, the host name is assigned in the format "macMACADDRESS" by default. The same syntax used for provisioning templates is used in this instance. See Section 15.3.5, “Host Name Patterns” for more information and examples.
    • Hosts limit is the the maximum number of provisioned hosts per rule. If the limit is reached, the rule will not take effect until one or more hosts are deleted. Typical use cases are rules per server rack or row when it is necessary to change provisioning parameters such as host name or host group per entry. You can set this value to zero (0) to specify no limit.
    • Priority specifies the order of execution of rules. The value must be greater than or equal to zero. A lower value indicates a higher priority. If two rules have the same priority, the first rule encountered is applied.
    • Enabled provides the option to temporarily enable or disable rules.
  3. Click Submit to save the rule.
By default, Satellite does not enable automatic discovery of hosts. The following procedure describes how to enable the discovery_auto variable to provide automatic provisioning according to specified rules.

Procedure 15.4. To Enable Automatic Provisioning:

  1. Navigate to AdministerSettingsDiscovered in the Satellite web UI.
  2. Locate discovery_auto in the Name column, and set its value to true.
  3. Click Save.
After you have defined some rules, Red Hat recommends that you discover a host and apply the rules using the Auto discover button on the host. This triggers auto-provisioning without the need to enable the global option.

15.3.4. Scoped Search Syntax

This section shows how to use scoped search syntax to filter the discovered hosts according to selected parameters. This is useful when creating a rule for automatic provisioning (see Section 15.3.3, “Automatically Provisioning Hosts”).
The search fields in the Satellite web UI support automatic completion to make building search strings easier. For example, you can test search patterns on the HostsDiscovered Hosts page. The following are examples of typical search queries:
  • facts.architecture = x86_64
  • facts.bios_vendor ~ 'Dell*'
  • facts.macaddress = "aa:bb:cc:dd:ee:ff"
  • facts.macaddress_eth0 = "aa:bb:cc:dd:ee:ff"
  • facts.ipaddress_eth1 ~ "192.168.*"
  • facts.architecture ^ (x86_64,i386)

Note

The caret symbol (^) in scoped searches means "in" (the same usage as in SQL) and not "starts with" as it is used in regular expressions. You can review the full list of scoped search operators at https://github.com/wvanbergen/scoped_search/blob/master/lib/scoped_search/query_language/tokenizer.rb
In Satellite 6.1, all facts are strings, so it is not possible to do numeric comparisons. However, three important facts are extracted and converted to numbers. These are described in Table 15.1, “Facts that Allow Numerical Comparison”.

Table 15.1. Facts that Allow Numerical Comparison

Search ParameterDescriptionExample Usage
cpu_count The number of CPUs cpu_count >= 8
disk_count The number of disks attached disk_count < 10
disks_size The total amount of disk space (in MiB) disks_size > 1000000

15.3.5. Host Name Patterns

This section lists the host name patterns that you can use when creating a rule for automatic provisioning (see Section 15.3.3, “Automatically Provisioning Hosts”).
The target host name template pattern has the same syntax as the provisioning templates (ERB). The domain is appended automatically. In addition to the @host attribute, the rand() function for random integers is available. For example:
  • application-server-<%= rand(99999) %>
  • load-balancer-<%= @host.facts['bios_vendor'] + '-' + rand(99999) %>
  • wwwsrv-<%= @host.hostgroup.name %>
  • minion-<%= @host.discovery_rule.name %>
  • db-server-<%= @host.ip.gsub('.','-') + '-' + @host.hostgroup.subnet.name %>>

Important

When creating host name patterns, ensure the resulting host names are unique. Host names must not start with numbers. A good approach is to use unique information provided by Facter (for example, the MAC address, BIOS or serial ID) or to otherwise randomize the host name.

15.3.6. Using the Discovery Plug-in on the Command Line

You can use the hammer command to perform certain tasks related to discovery. Run the hammer -h command to verify your configuration:
$ hammer -h | grep discovery
 discovery                     Manipulate discovered hosts.
 discovery_rule                Manipulate discovered rules.
Use the hammer discovery -h command to view the available options. For example, you can use the following command to reboot a discovered host (assuming its ID is 130):
$ hammer discovery reboot -id 130
Host reboot started