Questo contenuto non è disponibile nella lingua selezionata.

Chapter 1. Introducing configuration management by using Puppet


You can use Puppet to manage and automate configurations of hosts. Puppet uses a declarative language to describe the desired state of hosts.

Puppet increases your productivity as you can administer multiple hosts simultaneously. At the same time, it decreases your configuration effort as Puppet makes it easy to verify and possibly correct the state of the hosts.

Additional resources

1.1. How Puppet integrates with Satellite

Puppet uses a server-agent architecture. The Puppet server is the central component that stores configuration definitions. Satellite Server or Capsule Servers are typically deployed with the Puppet server and Satellite acts as an External Node Classifier (ENC) for such Puppet server. Hosts run the Puppet agent that communicates with the Puppet server.

The Puppet agent collects facts about a host and reports them to the Puppet server on each run. You can display the Puppet facts in JSON format by running puppet facts on a host.

The Puppet server forwards facts to Satellite and Satellite stores them for later use. Based on the facts and other definitions, Satellite constructs the ENC answer to the Puppet server. The Puppet server compiles a catalog based on the ENC answer and sends the catalog to the Puppet agent.

The Puppet agent evaluates the system state on the host. If the Puppet agent finds differences, known as drifts, between the desired state defined in the catalog and the actual state, it enforces correction of the state of the host. The Puppet agent then reports correction results back to the Puppet server, which reports them to Satellite.

Puppet modules

The desired state of a host is defined in a catalog. The catalog is compiled from Puppet manifests of one or more Puppet modules assigned to the host. A Puppet module is a collection of classes, manifests, resources, files, and templates. The Puppet modules work as components of host configuration definitions.

Smart Class parameters

You can override parameters of a Puppet module by using Smart Class parameters if the module supports the use of parameters. You can define the parameters in your Satellite as key-value pairs, which behave similar to host parameters or Ansible variables.

Puppet environments

You can also create multiple Puppet environments to control versions of configuration definitions or to manage variants of the definitions, and to test the definitions before you deploy them on production.

High-level integration steps

Puppet integration with Satellite involves the following high-level steps:

  1. Enable Puppet integration.
  2. Import Puppet agent packages into Satellite. Puppet agent packages can be managed like any other content with Satellite by enabling Red Hat Repositories and by using activation keys and content views.
  3. Install Puppet agent on hosts during provisioning, registration, manually, or by remote job execution.

Additional resources

The following procedures outline how to use a Puppet module to install, configure, and manage the ntp service to provide examples.

1.2. Supported Puppet versions and system requirements

Before you begin with the Puppet integration, review the supported Puppet versions and system requirements.

Supported Puppet Versions

Satellite supports Puppet server 8. Ensure that the Puppet modules used to configure your hosts are compatible with your Puppet version.

On hosts, you can use Puppet agent 7.

System Requirements
Before you begin integrating Puppet with your Satellite, ensure that you meet the system requirements. For more information, see System Requirements for Puppet 7 in the Open Source Puppet documentation.

1.3. Enabling Puppet integration with Satellite

By default, Satellite does not have any Puppet integration configured. You need to enable the integration as is appropriate for your situation. This means that you can configure Satellite to manage and deploy Puppet server on Satellite Server or Capsule Servers. Additionally, you can deploy Puppet server to Satellite externally and integrate it with Satellite for reporting, facts, and external node classification (ENC).

Procedure

  1. Enable Puppet integration and install Puppet server on Satellite Server:

    # satellite-installer \
    --enable-foreman-cli-puppet \
    --enable-foreman-plugin-puppet \
    --enable-puppet \
    --foreman-proxy-puppet true \
    --foreman-proxy-puppetca true \
    --puppet-server true
  2. If you want to use Puppet integration on Capsule Servers, enable Puppet integration and install Puppet server on Capsule Servers:

    # satellite-installer \
    --enable-puppet \
    --foreman-proxy-puppet true \
    --foreman-proxy-puppetca true \
    --puppet-server true

1.4. Installing and configuring Puppet agent during host provisioning

You can install and configure the Puppet agent on a host during the provisioning process. A configured Puppet agent is required on the host for Puppet integration with your Satellite.

Prerequisites

Procedure

  1. Navigate to Hosts > Templates > Provisioning Templates.
  2. Select a provisioning template depending on your host provisioning method. For more information, see Kinds of Provisioning Templates in Provisioning hosts.
  3. Ensure the puppet_setup snippet is included as follows:

    <%= snippet 'puppet_setup' %>

    Note that this snippet is already included in the templates shipped with Satellite, such as Kickstart default or Preseed default.

  4. Enable the Puppet agent using a host parameter in global parameters, a host group, or for a single host. To use Puppet 8, add a host parameter named enable-puppet8, select the boolean type, and set the value to true. To use Puppet 7, add a host parameter named enable-puppet7, select the boolean type, and set the value to true.
  5. Set configuration for the Puppet agent.

    • If you use an integrated Puppet server, ensure that you select a Puppet Capsule, Puppet CA Capsule, and Puppet environment when you create a host.
    • If you use a non-integrated Puppet server, either set the following host parameters in global parameters, or a host group, or when you create a host:

      • Add a host parameter named puppet_server, select the string type, and set the value to the hostname of your Puppet server, such as puppet.example.com.
      • Optional: Add a host parameter named puppet_ca_server, select the string type, and set the value to the hostname of your Puppet CA server, such as puppet-ca.example.com. If puppet_ca_server is not set, the Puppet agent will use the same server as puppet_server.
      • Optional: Add a host parameter named puppet_environment, select the string type, and set the value to the Puppet environment you want the host to use.
  6. Ensure your host has access to the Puppet agent packages from Satellite Server by using an appropriate activation key.

1.5. Installing and configuring Puppet agent during host registration

You can install and configure the Puppet agent on the host during registration. A configured Puppet agent is required on the host for Puppet integration with your Satellite.

Prerequisites

Procedure

  1. In the Satellite web UI, navigate to Configure > Global Parameters to add host parameters globally. Alternatively, you can navigate to Configure > Host Groups and edit or create a host group to add host parameters only to a host group.
  2. Enable the Puppet agent using a host parameter in global parameters or a host group.

    Add a host parameter named enable-puppet7, select the boolean type, and set the value to true.

  3. Specify configuration for the Puppet agent using the following host parameters in global parameters or a host group:

    • Add a host parameter named puppet_server, select the string type, and set the value to the hostname of your Puppet server, such as puppet.example.com.
    • Optional: Add a host parameter named puppet_ca_server, select the string type, and set the value to the hostname of your Puppet CA server, such as puppet-ca.example.com. If puppet_ca_server is not set, the Puppet agent will use the same server as puppet_server.
    • Optional: Add a host parameter named puppet_environment, select the string type, and set the value to the Puppet environment you want the host to use.

    Until the BZ2177730 is resolved, you must use host parameters to specify the Puppet agent configuration even in integrated setups where the Puppet server is a Capsule Server.

  4. Navigate to Hosts > Register Host and register your host using an appropriate activation key. For more information, see Registering Hosts in Managing hosts.
  5. Navigate to Infrastructure > Capsules.
  6. From the list in the Actions column for the required Capsule Server, select Certificates.
  7. Click Sign to the right of the required host to sign the SSL certificate for the Puppet agent.

1.6. Installing and configuring Puppet agent manually

You can install and configure the Puppet agent on a host manually. A configured Puppet agent is required on the host for Puppet integration with your Satellite.

Prerequisites

Procedure

  1. Log in to the host as the root user.
  2. Install the Puppet agent package.

    • On hosts running Red Hat Enterprise Linux 8 and above:

      # dnf install puppet-agent
    • On hosts running Red Hat Enterprise Linux 7 and below:

      # yum install puppet-agent
  3. Add the Puppet agent to PATH in your current shell using the following script:

    . /etc/profile.d/puppet-agent.sh
  4. Configure the Puppet agent. Set the environment parameter to the name of the Puppet environment to which the host belongs:

    # puppet config set server satellite.example.com --section agent
    # puppet config set environment My_Puppet_Environment --section agent
  5. Start the Puppet agent service:

    # puppet resource service puppet ensure=running enable=true
  6. Create a certificate for the host:

    # puppet ssl bootstrap
  7. In the Satellite web UI, navigate to Infrastructure > Capsules.
  8. From the list in the Actions column for the required Capsule Server, select Certificates.
  9. Click Sign to the right of the required host to sign the SSL certificate for the Puppet agent.
  10. On the host, run the Puppet agent again:

    # puppet ssl bootstrap

1.7. Performing configuration management

After you deploy Puppet agent on a host, you can start performing configuration management with Puppet. This involves the following high-level steps:

  1. Managing Puppet modules on the Puppet server, that is installing and updating them.
  2. Importing Puppet classes and environments from Puppet modules into Satellite.
  3. Optional: Creating config groups from Puppet classes.
  4. Configuring overrides of Smart Class parameters on various levels.
  5. Assigning Puppet classes or config groups to host groups or individual hosts.
  6. Configuring intervals for runs of the Puppet agent on hosts and for configuration enforcement runs of the Puppet server.
  7. Monitoring configuration management using reports in the Satellite web UI. For more information, see Monitoring Resources in Administering Red Hat Satellite.
  8. Configuring email notifications. For more information, see Configuring Email Notification Preferences in Administering Red Hat Satellite.

After assigning Puppet classes or config groups, Satellite runs configuration management automatically in the configured intervals to enforce Puppet configuration on your hosts, or you can initiate it manually on demand with the Run Puppet Once feature. For more information, see Section 9.1, “Running Puppet once using SSH”.

1.8. Disabling Puppet integration with Satellite

To discontinue using Puppet in your Satellite, follow this procedure.

Note that the command without the --remove-all-data argument removes all Puppet-related data in Satellite database. With the --remove-all-data argument, the command additionally removes Puppet server data files, including Puppet environments.

Warning

If you disable Puppet with the --remove-all-data argument, you will not be able to re-enable Puppet afterwards. This is a known issue, see the Bug 2087067.

Prerequisites

  • Puppet is enabled on Satellite.

Procedure

  1. If you have used Puppet server on any Capsules, disable Puppet server on all Capsules:

    # satellite-maintain plugin purge-puppet --remove-all-data
  2. Disable Puppet server on Satellite Server:

    # satellite-maintain plugin purge-puppet --remove-all-data
Red Hat logoGithubRedditYoutubeTwitter

Formazione

Prova, acquista e vendi

Community

Informazioni sulla documentazione di Red Hat

Aiutiamo gli utenti Red Hat a innovarsi e raggiungere i propri obiettivi con i nostri prodotti e servizi grazie a contenuti di cui possono fidarsi.

Rendiamo l’open source più inclusivo

Red Hat si impegna a sostituire il linguaggio problematico nel codice, nella documentazione e nelle proprietà web. Per maggiori dettagli, visita ilBlog di Red Hat.

Informazioni su Red Hat

Forniamo soluzioni consolidate che rendono più semplice per le aziende lavorare su piattaforme e ambienti diversi, dal datacenter centrale all'edge della rete.

© 2024 Red Hat, Inc.