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:
- Click Hosts > Create Host.
On the Host tab, enter the required details:
- In the Name field, enter the host name, for example host1.example.com.
- In the Organization field, enter the organization name, for example MyOrg.
- In the Location field, enter the location name, for example MyLoc.
- Optionally, on the Puppet Classes tab, select the Puppet classes you want to include.
On the Interfaces tab, edit the primary interface:
- Click the Edit button in the Actions column.
- Select a type from the Type drop-down menu, for example Interface.
- In the MAC address field, enter the MAC address of your host.
- In the Device Identifier field, specify the device identifier for this interface, for example eth0.
- 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.
- 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.
- In the IPv4 address field, specify the IPv4 address of your host.
- Click Ok.
On the Operating System tab, enter the required details:
- Select an architecture from the Architecture drop-down menu, for example x86_64.
- Select an operating system from the Operating system drop-down menu, for example RHEL Server 7.4.
- Select a partition table from the Partition table drop-down menu, for example Kickstart default.
- In the Root password field, enter the root password for your host.
- Optionally, on the Parameters tab, select the parameters you want to supply to the Puppet master to override the default values.
- Optionally, on the Additional Information tab, enter additional information about the host.
- 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:
- In a terminal, connect to the host as the root user.
Ensure that a time synchronization tool is enabled and running on the host:
# systemctl start chronyd; systemctl enable chronyd
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
- 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.
Clear any old host data related to Red Hat Subscription Manager (RHSM):
# subscription-manager clean
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
Enable the Red Hat Satellite Tools 6 repository:
# subscription-manager repos --enable=rhel-version-server-satellite-tools-6-rpms
Install the katello-agent:
# yum install katello-agent
Ensure the goferd service is running:
# systemctl start goferd
Install and configure the Puppet agent:
Install the Puppet agent:
# yum install puppet
Configure the Puppet agent to start at boot:
# systemctl enable puppet
Configure the Puppet agent by specifying the server and environment settings in the /etc/puppetlabs/puppet/puppet.conf file:
# vi /etc/puppetlabs/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 ...
Run the Puppet agent on the host:
# puppet agent -t --waitforcert 10 --server satellite.example.com
Sign the SSL certificate for the Puppet client in the Satellite Server web UI:
- Log in to the Satellite Server web UI.
- Select Infrastructure > Capsules.
- Select Certificates from the drop-down menu to the right of the required Capsule.
- Click Sign to the right of the required host.
puppet agentcommand 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:
- Navigate to Hosts > All hosts and select the target host, in our example host1.example.com.
- From the Select Action menu at the upper right of the screen select Schedule Remote Job.
On the Job invocation page, define the main job settings:
- Select a job category from the Job category drop-down menu, for example Commands.
- Select a job template from the Job template drop-down menu, for example Run Command - SSH Default.
- 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.
- Click Submit.