Chapter 8. Sample Scenarios

8.1. Simple Scenario

The simple scenario shows how to add a single host, register it, set up, and run a job on it.

8.1.1. Creating the Host

The following procedure provides an example on how to create a host in Red Hat Satellite.

To Create a Host:

  1. Click Hosts > Create Host.
  2. On the Host tab, enter the required details:

    1. In the Name field, enter the host name, for example host1.example.com.
    2. In the Organization field, enter the organization name, for example MyOrg.
    3. In the Location field, enter the location name, for example MyLoc.
  3. Optionally, on the Puppet Classes tab, select the Puppet classes you want to include.
  4. On the Interfaces tab, edit the primary interface:

    1. Click the Edit button in the Actions column.
    2. Select a type from the Type drop-down menu, for example Interface.
    3. In the MAC address field, enter the MAC address of your host.
    4. In the Device Identifier field, specify the device identifier for this interface, for example eth0.
    5. In the DNS name field, specify the DNS name of your host. For the primary interface, this host name is used with the domain name to form the FQDN.
    6. Select a domain from the Domain drop-down menu, for example satellite.example.com. This automatically updates the IPv4 Subnet and IPv6 Subnet lists with a selection of available subnets. Optionally, select the subnets.
    7. In the IPv4 address field, specify the IPv4 address of your host.
    8. Click Ok.
  5. On the Operating System tab, enter the required details:

    1. Select an architecture from the Architecture drop-down menu, for example x86_64.
    2. Select an operating system from the Operating system drop-down menu, for example RHEL Server 7.4.
    3. Select a partition table from the Partition table drop-down menu, for example Kickstart default.
    4. In the Root password field, enter the root password for your host.
  6. Optionally, on the Parameters tab, select the parameters you want to supply to the Puppet master to override the default values.
  7. Optionally, on the Additional Information tab, enter additional information about the host.
  8. Click Submit.

8.1.2. Registering the Host

After you have created host1.example.com, you must register it so that it can receive updates. The following procedure assumes the host is running Red Hat Enterprise Linux 7.

To Register the Host:

  1. In a terminal, connect to the host as the root user.
  2. Ensure that a time synchronization tool is enabled and running on the host:

    # systemctl start chronyd; systemctl enable chronyd
  3. Install the consumer RPM from the Satellite Server or Capsule Server to which the host is to be registered. The consumer RPM updates the content source location of the host and allows the host to download content from the content source specified in Red Hat Satellite.

    # rpm -Uvh http://satellite.example.com/pub/katello-ca-consumer-latest.noarch.rpm
  4. Ensure that an activation key associated with the appropriate Content View and environment exists for the host. If not, see Managing Activation Keys in the Content Management Guide for more information.
  5. Clear any old host data related to Red Hat Subscription Manager (RHSM):

    # subscription-manager clean
  6. Register the host using RHSM:

    # subscription-manager register --org=MyOrg \
    --activationkey=my_activation_key

    Command output after registration:

    # subscription-manager register --org=MyOrg --activationkey=my_activation_key
    The system has been registered with id: 62edc0f8-855b-4184-b1b8-72a9dc793b96
  7. Enable the Red Hat Satellite Tools 6 repository:

    # subscription-manager repos --enable=rhel-version-server-satellite-tools-6-rpms
  8. Install the katello-agent:

    # yum install katello-agent
  9. Ensure the goferd service is running:

    # systemctl start goferd
  10. Install and configure the Puppet agent:

    1. Install the Puppet agent:

      # yum install puppet
    2. Configure the Puppet agent to start at boot:

      # systemctl enable puppet
    3. Configure the Puppet agent by specifying the server and environment settings in the /etc/puppet/puppet.conf file:

      # vi /etc/puppet/puppet.conf
      [main]
          # The Puppet log directory.
          # The default value is '$vardir/log'.
          logdir = /var/log/puppet
      
          # Where Puppet PID files are kept.
          # The default value is '$vardir/run'.
          rundir = /var/run/puppet
      
          # Where SSL certificates are kept.
          # The default value is '$confdir/ssl'.
          ssldir = /var/lib/puppet/ssl
      
      ...
      
      [agent]
          # The file in which puppetd stores a list of the classes
          # associated with the retrieved configuratiion.  Can be loaded in
          # the separate ``puppet`` executable using the ``--loadclasses``
          # option.
          # The default value is '$confdir/classes.txt'.
          classfile = $vardir/classes.txt
          pluginsync = true
          report = true
          ignoreschedules = true
          daemon = false
          ca_server = satellite.example.com
          server = satellite.example.com
          environment = KT_Example_Org_Library_RHEL7Server
      
          # Where puppetd caches the local configuration.  An
          # extension indicating the cache format is added automatically.
          # The default value is '$confdir/localconfig'.
          localconfig = $vardir/localconfig
      
      ...
    4. Run the Puppet agent on the host:

      # puppet agent -t --waitforcert 10 --server satellite.example.com
    5. Sign the SSL certificate for the Puppet client through the Satellite Server web UI:

      1. Log in to the Satellite Server through the web UI.
      2. Select Infrastructure > Capsules.
      3. Select Certificates from the drop-down menu to the right of the required Capsule.
      4. Click Sign to the right of the required host.
      5. Enter the puppet agent command again:

        # puppet agent -t --server satellite.example.com

8.1.3. Running a Job on the Host

The following procedure shows how to run a job template on the previously created and registered host host1.example.com.

To Execute a Remote Job:

  1. Navigate to Hosts > All hosts and select the target host, in our example host1.example.com.
  2. From the Select Action menu at the upper right of the screen select Schedule Remote Job.
  3. On the Job invocation page, define the main job settings:

    1. Select a job category from the Job category drop-down menu, for example Commands.
    2. Select a job template from the Job template drop-down menu, for example Run Command - SSH Default.
    3. In the command field, enter the command you want to run on the host. For example, timedatectl set-timezone Europe/Prague will set the time zone to Prague in Europe.
  4. Click Submit.