Bookmark this page

Automate with Activation Keys

Objectives

  • Create and use activation keys to automatically register and configure a system for Satellite Server management.

Automate Content Host During Registration

Activation keys provide a method for automating initial host configuration during registration. You can create multiple keys and associate them with different environments and Content Views. For example, you might create a basic activation key with a subscription for Red Hat Enterprise Linux workstations and associate it with Content Views from a particular environment.

Activation keys can define the following properties for content hosts:

  • Associated subscriptions and subscription attachment behavior

  • Available products and repositories

  • A lifecycle environment and a Content View

  • Host collection membership

If you enable Simple Content Access (SCA) on Satellite Server, then hosts can access content without attaching a subscription, so you do not need to associate subscriptions and subscription attachments with activation keys. However, if you do not use SCA, then you must associate subscriptions and subscription attachments with the activation keys so that the registered hosts can access the content of those subscriptions.

Note

Activation keys are used only when hosts are registered. If you change an activation key, then these changes do not apply to hosts that were previously registered with the key without the changes. These changes apply only to hosts that are subsequently registered with the amended activation key.

Create Activation Keys

Activation keys are defined within an organizational context. You must select an organization to access the Activation Keys page in the Satellite web UI.

To create an activation key by using the Satellite web UI, first log in as the admin user and select the appropriate organization. Then, navigate to ContentActivation Keys, click Create Activation Key, and enter a name for your activation key. To set the maximum number of systems that you can register by using this activation key, clear the Unlimited Hosts checkbox and enter the maximum number in the Limit field. Optionally add a brief description for the activation key. In the Environment section, select the environment to use with this activation key. After you select an environment, a list is displayed beneath the Content View section. Select a content view to use and then click Save.

Alternatively, use the hammer command to create an activation key:

[root@satellite ~]# hammer activation-key create \
--name "Activation_Key_Name" \
--unlimited-hosts \
--description "Example description" \
--lifecycle-environment "Example environment" \
--content-view "Example content view" \
--organization "Organization_Name"

Manage Subscriptions with Activation Keys

If your organization uses SCA, then the organization's entitled repositories are enabled at the organization level, and become available for immediate use on all registered hosts in that organization, with the content views implementing necessary limitations. Thus, you do not need to add subscriptions to the activation keys.

Note

Red Hat recommends use of the optional SCA feature for managing subscriptions. SCA no longer requires attaching subscriptions to specific keys.

If your organization does not use SCA, then you can associate subscriptions with activation keys, so that hosts that use the activation keys are automatically attached to the associated subscriptions when they register with Satellite Server.

To associate subscriptions with your activation keys by using the Satellite web UI, first navigate to ContentActivation Keys. Then, click the name of an activation key to configure, and click the Subscriptions tab to list the current subscriptions that are associated with the activation key.

The Auto-Attach checkbox is enabled by default. If you enable the auto-attach option on an activation key and subscriptions are associated with the key, then the subscription management service selects and attaches the best-matched associated subscriptions. The auto-attach feature is not necessary in an organization that uses SCA, because the activation keys do not perform client-side subscription management when SCA is enabled. The criteria to attach the subscriptions are based on the currently installed products, architecture, and preferences, such as the service level.

You can also enable auto-attach but without subscriptions that are associated with the key. Use this type of key to register virtual machines without the virtual machine consuming a Red Hat Enterprise Linux subscription.

To add a subscription, click the Add tab, select the checkbox for the subscription to add, and then click Add Selected. To remove a subscription, click the List/Remove tab, select the checkbox for the subscription to remove, and then click Remove Selected.

Alternatively, use the hammer command to add a subscription to an activation key:

  • Obtain a list of an organization's subscription IDs:

    [root@satellite ~]# hammer --output base subscription list \
    --organization "Organization_Name"
    Id:         4
    Uuid:       2c997a90801a3b1801801b2187d50d76
    Name:       Red{nbsp}Hat Enterprise{nbsp}Linux Server, Standard (Physical or Virtual Nodes)
    Type:       Physical
    Contract:   12017022
    Account:    5508397
    Support:    Standard
    Start Date: 2019/09/30 04:00:00
    End Date:   2024/09/30 03:59:59
    Quantity:   10
    Consumed:   0
    
    ...output omitted...
  • Add the Red Hat Enterprise Linux subscription UUID to the activation key:

    [root@satellite ~]# hammer activation-key add-subscription \
    --name "Activation_Key_Name" \
    --subscription-id 2c997a90801a3b1801801b2187d50d76 \
    --organization "Organization_Name"

Manage Host Collections with Activation Keys

You can associate host collections with activation keys so that hosts that use those activation keys are automatically added to the associated host collections when they register with Satellite Server.

In the Satellite web UI, navigate to ContentActivation Keys. Click the name of an activation key to configure. Click the Host Collections tab to list current host collections that are associated with the activation key.

You can add or remove a host collection by clicking the Add or List/Remove tab, selecting the checkbox for the host collection to interact and then clicking Add Selected or Remove Selected.

Use Multiple Activation Keys with a Content Host

You can associate a content host with multiple activation keys, which Satellite combines to define the host settings. In the event of conflicting settings, the last specified activation key takes precedence. You can specify the order of precedence by setting a host group parameter as follows:

[root@satellite ~]# hammer hostgroup set-parameter \
--name kt_activation_keys \
--value name_of_first_key, name_of_second_key,... \
--hostgroup hostgroup_name

Register Hosts with an Activation Key

After you create an activation key, you can use it as an argument to the subscription-manager command when you register a host to Satellite Server.

Prepare a Host for Registration to Satellite Server

Before you register a host to Satellite Server, to ensure proper interaction between the Satellite Server and the host, use the timedatectl command and chronyd tool to verify the date and time synchronization on both systems.

Then, download the consumer certificate RPM for your Satellite Server. This RPM installs the necessary certificates for accessing repositories on Satellite Server and configures Red Hat Subscription Manager to use the Satellite Server URL. The RPM is in the /pub directory on the Satellite's web server. For example, for a Satellite Server with the satellite.example.com hostname, enter the following command on the host:

[root@host ~]# dnf localinstall \
http://satellite.example.com/pub/katello-ca-consumer-latest.noarch.rpm

Use an Activation Key to Register a Host to Satellite Server

The following command registers the host to the default organization on Satellite Server and uses the --activationkey option to reference the TestKey activation key:

[root@host ~]# subscription-manager register --org  "Default_Organization" \
--activationkey TestKey
The system has been registered with ID: 3244ed9d-ce23-4a2a-a39d-112324d84b3c
The registered system name is: host.example.com

After you register a host to Satellite Server, the host gains access to repository contents. However, before you can manage packages and errata, you must install the Katello Agent on the host system.

[root@host ~]# dnf install katello-agent

In the Satellite web UI, navigate to HostsContent Hosts to verify successful registration of a host.

References

For more information, refer to the Managing Activation Keys chapter in the Red Hat Satellite 6.11 Managing Content Guide at https://access.redhat.com/documentation/en-us/red_hat_satellite/6.11/html-single/managing_content/index#Managing_Activation_Keys_content-management

Revision: rh403-6.11-3ad886e