第10章 Managing Activation Keys

Activation keys provide a method to automate system registration and subscription attachment. 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.

コンテンツホストの登録時にアクティベーションキーを使用して、プロセスのスピードアップ、単純化、一貫性の向上を図ることができます。

アクティベーションキーを使用して、コンテンツホストの次のプロパティーを定義できます。

  • 関連付けるサブスクリプションおよびサブスクリプションのアタッチの動作。
  • Available products and repositories.
  • A life cycle environment and a Content View.
  • Host collection membership.

サブスクリプションが十分にある場合には、同じアクティベーションキーを複数のコンテンツホストに適用できます。ただし、アクティベーションキーはコンテンツホストの初期設定のみを行います。コンテンツホストを組織に登録した後は、組織のコンテンツをコンテンツホストに手動でアタッチできます。

A content host can be associated with multiple activation keys that are combined to define the host settings. In case of conflicting settings, the last specified activation key takes precedence.

アクティベーションキーは、ホストが登録されている場合にのみ使用できます。アクティベーションキーに変更が加えられた場合には、それ以降、改訂されたアクティベーションキーで登録されるホストにのみ、変更が適用され、既存のホストには加えられません。

10.1. Creating an Activation Key

With activation keys, you can define how the content host is subscribed during registration. The subscription behavior defined by the activation key depends on two factors:

  • Are there any subscriptions associated with the activation key?
  • Is the auto-attach option enabled?

上記の要因をもとに、アクティベーションキーを使用してサブスクライブするシナリオを 3 つ想定できます。

  1. Activation key with no subscriptions specified.

    With no subscriptions specified and auto-attach enabled, hosts using the activation key search for the best fitting subscription from the ones provided by Satellite Server. This is similar to entering the subscription-manager --auto-attach command.

  2. 自動アタッチ用にカスタムサブスクリプションプールを指定するアクティベーションキー。

    If there are subscriptions specified and auto-attach is enabled, hosts using the activation key select the best fitting subscription from the list specified in the activation key.

  3. Activation key with the exact set of subscriptions.

    If there are subscriptions specified and auto-attach is disabled, hosts using the activation key are associated with all subscriptions specified in the activation key.

Custom Products

カスタム製品 (通常は Red Hat が提供しないコンテンツを含む製品) がアクティベーションキーに割り当てられている場合には、この製品は、自動アタッチの設定の有無にかかわらず、登録されたコンテンツホストに対して常に有効になります。

Procedure

To create an activation key, complete the following steps:

  1. In the Satellite web UI, navigate to Content > Activation keys and click Create Activation Key.
  2. 名前 フィールドに、アクティベーションキーの名前を入力します。
  3. If you want to set a limit, clear the Unlimited hosts check box, and in the Limit field, enter the maximum number of systems you can register with the activation key. If you want unlimited hosts to register with the activation key, ensure the Unlimited Hosts check box is selected.
  4. In the Description field, enter a description for the activation key.
  5. 環境 一覧から、使用する環境を選択します。
  6. コンテンツビュー 一覧から、使用するコンテンツビューを選択します。
  7. 保存 をクリックし、アクティベーションキーウィンドウに新しいアクティベーションキーが表示されたら、編集する名前をクリックします。
  8. アタッチする製品と、登録時に有効にするリポジトリーを定義するには、サブスクリプション タブをクリックし、追加するサブスクリプションを選択して、追加 をクリックします。
  9. Satellite Web UI で、製品コンテンツ ページに移動します。たとえば、Red Hat Satellite Tools リポジトリーを有効にするには、Red Hat Satellite Tools 6.5 (for RHEL 7 Server) (RPMs) - Enabled で、はいに上書き を選択します。
  10. 保存をクリックします。

For CLI Users

  1. Create the activation key:

    # hammer activation-key create \
    --name "My_Activation_Key" \
    --unlimited-hosts \
    --description "Example Stack in the Development Environment" \
    --lifecycle-environment "Development" \
    --content-view "Stack" \
    --organization "My_Organization"
  2. Obtain a list of your subscription IDs:

    # hammer subscription list --organization "My_Organization"
  3. Attach the Red Hat Enterprise Linux subscription UUID to the activation key:

    # hammer activation-key add-subscription \
    --name "My_Activation_Key" \
    --subscription-id ff808181533518d50152354246e901aa \
    --organization "My_Organization"
  4. List the product content associated with the activation key:

    # hammer activation-key product-content \
    --name "My_Activation_Key" \
    --organization "My_Organization"
  5. Override the default auto-enable status for the Red Hat Satellite Tools 6.5 repository. The default status is set to disabled. To enable, enter the following command:

    # hammer activation-key content-override \
    --name "My_Activation_Key" \
    --content-label rhel-7-server-satellite-tools-6.5-rpms \
    --value 1 \
    --organization "My_Organization"

10.2. Updating Subscriptions Associated with an Activation Key

You can change the subscriptions associated with an activation key using the web UI or using the Hammer command-line tool.

アクティベーションキーへの変更は、変更後にプロビジョニングしたマシンにのみ適用されます。既存のコンテンツホストでサブスクリプションを更新する方法は 「Bulk Updating Content Hosts' Subscriptions」 を参照してください。

Procedure

To update the subscriptions associated with an activation key, complete the following steps:

  1. Satellite Web UI で、コンテンツ > アクティベーションキー に移動し、アクティベーションキーの名前をクリックします。
  2. Click the Subscriptions tab.
  3. To remove subscriptions, select List/Remove, and then select the check boxes to the left of the subscriptions to be removed and then click Remove Selected.
  4. サブスクリプションを追加するには、追加 を選択してから、追加するサブスクリプションの左側のチェックボックスを選択し、選択した項目を追加 をクリックします。
  5. リポジトリーセット タブをクリックし、リポジトリーのステータス設定を確認します。
  6. To enable or disable a repository, select the check box for a repository and then change the status using the Select Action list.
  7. Click the Details tab, select a Content View for this activation key, and then click Save.

For CLI Users

  1. 現在アクティベーションキーが含まれているサブスクリプションを一覧表示します。

    # hammer activation-key subscriptions \
    --name My_Activation_Key \
    --organization "My_Organization"
  2. Remove the required subscription from the activation key:

    # hammer activation-key remove-subscription \
    --name "My_Activation_Key" \
    --subscription-id ff808181533518d50152354246e901aa \
    --organization "My_Organization"

    For the --subscription-id option, you can use either the UUID or the ID of the subscription.

  3. Attach new subscription to the activation key:

    # hammer activation-key add-subscription \
    --name "My_Activation_Key" \
    --subscription-id ff808181533518d50152354246e901aa \
    --organization "My_Organization"

    For the --subscription-id option, you can use either the UUID or the ID of the subscription.

  4. List the product content associated with the activation key:

    # hammer activation-key product-content \
    --name "My_Activation_Key" \
    --organization "My_Organization"
  5. Override the default auto-enable status for the required repository:

    # hammer activation-key content-override \
    --name "My_Activation_Key" \
    --content-label content_label \
    --value 1 \
    --organization "My_Organization"

    For the --value option, enter 1 for enable, 0 for disable.

10.3. CSV ファイルを使用してアクティベーションキーに関連付けられたサブスクリプションを更新する手順

You can update the subscriptions associated with an activation key by downloading a CSV file, making changes to the Activation Key settings, and then uploading the changed CSV file.

Subscription information in the CSV File

CSV ファイルの最後の列にサブスクリプション情報が含まれます。サブスクリプション情報は、CSV ファイル内の 1 つのフィールドであり、引用符で囲まれたテキストにコンマを含めることができます。

The entries in the CSV file have the following format:

Name  Organization  Description  Limit  Environment  Content View  Host Collections  Auto-Attach  Service Level  Release Version  Subscriptions

サブスクリプション フィールドに含まれる例を示します。

Automatic|RH1234|Red Hat Enterprise Linux Server, Standard (Physical or Virtual Nodes)|11223344|55667788

1|MCT0369|Red Hat Satellite Capsule Server|11223344|55667788

The Subscriptions field has the following format:

  • 割り当てられるサブスクリプションの数。自動 に設定できます。
  • The subscription’s identification number.
  • The subscription’s name.
  • The contract number.
  • The account number.

Procedure

To update the subscription list using a CSV file, complete the following procedure:

  1. Export the subscriptions from Satellite Server to a CSV file. For this example, a_keys.csv:

    # hammer --server https://satellite.example.com csv activation-keys \
    --export --file a_keys.csv --organization "My_Organization"
  2. To view the columns of the file, enter the following command:

    # column -s, -t < a_keys.csv | less -S
  3. Change the required values in the CSV file. You can use an editor, with a CSV plug-in, or sed to change strings in the Subscriptions field.
  4. Make a backup of the file.

    # cp a_keys.csv a_keys.csv.backup
  5. Edit the string you want to change. For example:

    # sed -i "s/Automatic|RH1234|Red Hat Enterprise Linux Server/Automatic|RH4567|Red Hat Enterprise Linux Server/g" a_keys.csv
  6. Confirm only the required changes were made. For example:

    # diff a_keys.csv a_keys.csv.backup
  7. Upload the changed file to Satellite Server.

    # hammer --server https://satellite.example.com csv activation-keys \
    --file a_keys.csv

10.4. Using Activation Keys for Host Registration

You can use activation keys to complete the following tasks:

  • Registering new hosts during provisioning through Red Hat Satellite 6. The kickstart provisioning templates in Red Hat Satellite 6 contain commands to register the host using an activation key that is defined when creating a host.
  • 既存の Red Hat Enterprise Linux ホストを登録する。Red Hat サブスクリプションマネージャーが登録に Satellite Server を使用するように設定し、subscription-manager register コマンドの実行時にアクティベーションキーを指定します。

Procedure

アクティベーションキーを使用して、既存の Red Hat Enterprise Linux 7 ホストを、Satellite Server に登録するには、以下の手順を行います。

  1. Satellite Server 用のコンシューマー RPM をダウンロードします。これは、ホストの Web サーバーの pub ディレクトリーに配置されています。たとえば、ホスト名が satellite.example.com の Satellite Server の場合は、登録するホストで以下のコマンドを実行します。

    # rpm -Uvh http://satellite.example.com/pub/katello-ca-consumer-latest.noarch.rpm

    This RPM installs the necessary certificates for accessing repositories on Satellite Server and configures Red Hat Subscription Manager to use the server’s URL.

  2. On the host, enter the following command to register the host to Satellite using the activation key:

    # subscription-manager register --activationkey="My_Activation_Key" \
    --org="My_Organization"
  3. To view a list of hosts for an organization, on Satellite Server, enter the following command:

    # hammer host list --organization "My_Organization"
  4. Satellite Server にホストを登録したら、ホストに katello-agent パッケージをインストールして、ホストから Satellite Server にレポートできるようにします。

    # yum install katello-agent

    このパッケージは、Red Hat Satellite Tools 6.5 リポジトリーに含まれます。

Multiple Activation Keys

コンテンツホストの登録時に複数のアクティベーションキーを使用できます。特定のサブスクリプションセット用にアクティベーションキーを作成し、コンテンツホストの要件に合わせて、これらのアクティベーションキーを組み合わせることができます。たとえば、以下のコマンドは VDC と OpenShift の両方のサブスクリプションでコンテンツホストを組織に登録します。

# subscription-manager register --org="My_Organization" \
--activationkey="ak-VDC,ak-OpenShift"

Settings Conflicts

If there are conflicting settings in activation keys, the rightmost key takes precedence.

  • Settings that conflict: Service Level, Release Version, Environment, Content View, and Product Content.
  • Settings that do not conflict and the host gets the union of them: Subscriptions and Host Collections.
  • Settings that influence the behavior of the key itself and not the host configuration: Content Host Limit and Auto-Attach.

10.5. Enabling Auto-Attach

When auto-attach is enabled on an activation key and there are subscriptions associated with the key, the subscription management service selects and attaches the best-matched associated subscriptions based on a set of criteria like currently-installed products, architecture, and preferences like service level.

You can enable auto-attach and have no subscriptions associated with the key. This type of key is commonly used to register virtual machines when you do not want the virtual machine to consume a RHEL subscription but to inherit a RHEL Virtual Data Center (VDC) subscription from the hypervisor.

Auto-attach is enabled by default. Disable the option if you want to force attach all subscriptions associated with the activation key.

Procedure

To enable auto-attach, complete the following steps:

  1. Satellite Web UI で、コンテンツ > アクティベーションキー に移動します。
  2. Click the activation key name that you want to edit.
  3. Click the Subscriptions tab.
  4. 自動アタッチの隣にある編集アイコンをクリックします。
  5. Select or clear the check box to enable or disable auto-attach.
  6. 保存をクリックします。

自動アタッチアクティベーションキーを使用して仮想コンテンツホストを Satellite Server に登録するには、まず virt-who ユーティリティーを使用して、この仮想コンテンツホストを Virtual Datacenter (VDC) サブスクリプションのエンタイトルメントに含まれるハイパーバイザーにマッピングします。この前提条件が満たされない場合には、仮想ホストは、24 時間のみ、一時的に仮想サブスクリプションに登録されます。詳細は、『仮想インスタンスガイド』の「仮想ゲストのサブスクリプションの適用」を参照してください。

For CLI Users

To enable auto-attach on the activation key:

# hammer activation-key update --name "My_Activation_Key" \
--organization "My_Organization" --auto-attach true

10.6. Setting the Service Level

アクティベーションキーで作成した新規ホストのデフォルトのサービスレベルを定義するように、アクティベーションキーを設定できます。デフォルトのサービスレベルを設定すると、ホストにアタッチするのに適したサブスクリプションのみが選択されます。たとえば、アクティベーションキーのデフォルトのサービスレベルが Premium に設定されている場合には、Premium サービスレべルのサブスクリプションのみが、登録時にホストに割り当てられます。

Procedure

To set the service level, complete the following steps:

  1. Satellite Web UI で、コンテンツ > アクティベーションキー に移動します。
  2. Click the activation key name you want to edit.
  3. サービスレベルの隣にある編集アイコンをクリックします。
  4. Select the required service level from the list. The list only contains service levels available to the activation key.
  5. 保存をクリックします。

For CLI Users

To set a default service level to Premium on the activation key:

# hammer activation-key update --name "My_Activation_Key" \
--organization "My_Organization" --service-level premium