Red Hat Training

A Red Hat training course is available for Red Hat Satellite

Chapter 4. Managing Activation Keys

Activation keys define the subscription properties of a host. Using an activation key improves the speed of host registration. For web UI equivalents of the following procedures see Managing Activation Keys in the Content Management Guide.

There are three possible use cases for activation keys:

Note

Activation keys are only used when hosts are registered. If changes are made to an activation key, it is only applicable to hosts that are registered with the amended activation key in the future. The changes are not made to existing hosts.

To create an activation key, issue the following command:

$ hammer activation-key create --name ak_name \
--organization-label org_label \
--content-view cv_name \
--lifecycle-environment lc_name

Note that the Content View has to be published. To see the full list of operations related to activation keys, use the hammer activation-key --help command.

To add a subscription to the activation key, issue the following command:

$ hammer activation-key add-subscription \
--id ak_ID \
--subscription-id sub_ID

To find the activation key ID, use hammer activation-key list; to find the subscription ID, use hammer subscription list.

Example 4.1. Creating an Empty Activation Key

This example shows how to create an activation key that directs the associated hosts to automatically attach a best fitting subscription:

$ hammer activation-key create \
--name "automatically attach key" \
--organization $ORG \
--content-view cv-rhel7-server \
--lifecycle-environment Testing

As a result, hosts registered in the cv-rhel7-server Content View are associated with this activation key.

Example 4.2. Creating an Activation Key with Custom Subscription Pool

This example shows how to create an activation key that will direct the associated hosts to automatically attach a best fitting subscription from the list specified in the activation key.

First create an empty activation key:

$ hammer activation-key create \
--name "custom pool key" \
--organization $ORG \
--content-view cv-rhel7-server \
--lifecycle-environment Testing

Add a subscription to the activation key:

$ hammer activation-key add-subscription \
--name "custom pool key" \
--subscription-id 1

Keep repeating this step to add all required subscriptions to the activation key.

Example 4.3. Creating an Activation Key with Mandatory Subscription List

This example shows how to create an activation key that will direct the associated hosts to attach all subscriptions specified in the activation key.

First, create an activation key and add all required subscriptions to it. Follow the steps from Example 4.2, “Creating an Activation Key with Custom Subscription Pool”.

Then disable the auto-attach property of the activation key:

$ hammer activation-key update \
--organization $ORG \
--name "mandatory subs key" \
--auto-attach false
Important

You can assign several activation keys to a Content View. In case of conflicting settings, the values from the last specified key take precedence. You can specify the order of precedence by setting a host group parameter as follows:

$ hammer hostgroup set-parameter \
--name kt_activation_keys \
--value name_of_first_key, name_of_second_key,... \
--hostgroup hostgroup_name