13.4. Storing and Maintaining Host Information
- Foreman: Provides for the provisioning and life cycle management of physical and virtual systems. Foreman automatically configures these systems using various methods, including kickstart and Puppet modules.
- Puppet: A client/server architecture for configuring hosts, consisting of the Puppet Master (server) and the Puppet Agent (client).
- Facter: Puppet's system inventory tool. Facter gathers basic information (facts) about hosts such as hardware details, network settings, OS type and version, IP addresses, MAC addresses, SSH keys, and more. These facts are then made available in Puppet manifests as variables.
13.4.1. The Puppet Architecture
- It compiles a catalog
- It applies that catalog to the appropriate host
--noop parameter had been used, to the Puppet Master, which in turn sends the results to Foreman. This catalog describes the desired state for one specific host. It lists the resources to manage on that host, including any dependencies between those resources. The agent applies the catalog to the host.
/etc/puppet/puppet.conf file using the runinterval parameter. You can also run puppet agent apply to initiate communication manually.
13.4.2. Using Facter and Facts
httpd service should always be running and Puppet knows how to handle that. If you are managing different operating systems, you can use the osfamily fact to create conditional expressions to tell Puppet which service to watch or which package to install. You can use the operatingsystemmajrelease and versioncmp parameters to create conditional expressions based on different versions of the same operating system. See Example 13.1, “Using Conditional Expressions with Facts” for an example of using conditional expressions.
Example 13.1. Using Conditional Expressions with Facts
if $:: osfamily == 'RedHat' {
if $::operatingsystemmajrelease == '6' {
$ntp_service_name = 'ntpd'
}
elseif versioncmp($::operatingsystemmajrelease, '7') >= 0 {
$ntp_service_name = 'chrony'
}
}
Note
13.4.2.1. Displaying Facts for a Particular Host
facter -p) and also from the web UI ( → ). You can browse the list of facts or use the Search box to search for specific facts. For example, type "facts." to display a list of available facts.
Note
Procedure 13.16. To View Facts for a Particular Host:
- On the main menu, click → and then click the name of the host that you want to inspect.
- In the Details pane, click to display all known facts about the host.
Note
- For any fact listed on this page, you can click to display a chart of the distribution of this fact name over all managed hosts.
- You can bookmark a search to make it easier to use in the future. When you have refined your search, click the drop-down arrow next to the button, and click . Bookmarked searches appear in the drop-down list, and also under → on the main menu.
13.4.2.2. Searching for Hosts based on Facts
facts.architecture = x86_64.
Procedure 13.17. To Search for Hosts Based on Facts:
- On the main menu, click → to display the Fact Values page.
- In the Search field, start typing the name of the fact that you want to filter by. You can search by specific name, name/value pairs, and so on.
- Click to retrieve the list of matching hosts.
13.4.2.3. Custom Fact Reporting
- The manifest
pkginventoryis obtained from Puppet Forge and saved to the base system. - The Puppet module is added to a content view and then this is promoted to a system and deployed to that system.
- The facts for the system are then queried using a package name. In this example, for a host called hostname and using a Satellite user with credentials username and password, the following API query would return the facts that matched the search string "bash":
curl -u username:password -X GET http://localhost/api/hosts/:hostname/facts?search=bash {"hostname":{"pkg_bash":"4.2.45-5.el7_0.4"}}The search returns the package version. This could then be used to populate an external database.
Adding the pkginventory Puppet Module
pkginventory Puppet module to the Red Hat Satellite Server application, download the module from https://forge.puppetlabs.com/ody/pkginventory to the base system where the Satellite Server application is installed and then follow the procedures below.
Procedure 13.18. Uploading a Puppet Module to a Repository
- Download the Puppet module to the base system. Modules that are downloaded will have a
.tar.gzextension. - Click → and then click the product name in the Name field associated with the Puppet module repository. For example, Custom Products.
- On the Repositories tab, select the Puppet Modules repository you want to modify. For example, Puppet Modules.
- In the Upload Puppet Module section, click , and navigate to the module that you downloaded.
- Click .
Procedure 13.19. Adding a Module to a Content View
- Click → and then select a content view from the menu.
- On the Puppet Modules tab, click . A list of installed modules appears.
- From the Actions column, click to select the module you want to add. A table of available versions appears.
- Click next to the version of the module that you want to add.
- Click to create the new Content View.
- Optionally add a description and click .

Where did the comment section go?
Red Hat's documentation publication system recently went through an upgrade to enable speedier, more mobile-friendly content. We decided to re-evaluate our commenting platform to ensure that it meets your expectations and serves as an optimal feedback mechanism. During this redesign, we invite your input on providing feedback on Red Hat documentation via the discussion platform.