Red Hat Training
A Red Hat training course is available for Red Hat OpenStack Platform
第5章 オーバークラウドの登録
オーバークラウドでは、Red Hat コンテンツ配信ネットワーク、Red Hat Satellite 5 サーバー、Red Hat Satellite 6 サーバーのいずれかにノードを登録することができます。
5.1. 環境ファイルを使用したオーバークラウドの登録
登録ファイルを Heat テンプレートコレクションからコピーします。
$ cp -r /usr/share/openstack-tripleo-heat-templates/extraconfig/pre_deploy/rhel-registration ~/templates/.
~/templates/rhel-registration/environment-rhel-registration.yaml
を編集し、登録の方法と詳細に応じて以下の値を変更します。
一般的なパラメーター
- rhel_reg_method
-
登録の方法を選択します。
portal
、satellite
、disable
のいずれかです。 - rhel_reg_type
-
登録するユニットの種別。
system
として登録するには空欄のままにします。 - rhel_reg_auto_attach
-
互換性のあるサブスクリプションをこのシステムに自動的にアタッチします。有効にするには、
true
に設定します。この機能を無効にするには、このパラメーターを環境ファイルから削除します。 - rhel_reg_service_level
- 自動アタッチメントに使用するサービスレベル
- rhel_reg_release
- このパラメーターを使用して、自動アタッチメント用のリリースバージョンを設定します。Red Hat サブスクリプションマネージャーからのデフォルトを使用するには、空欄のままにします。
- rhel_reg_pool_id
-
使用するサブスクリプションプール ID。サブスクリプションを自動でアタッチしない場合には、このパラメーターを使用してください。この ID を特定するには、アンダークラウドノードから
sudo subscription-manager list --available --all --matches="*OpenStack*"
を実行して、出力されるPool ID
値を使用します。 - rhel_reg_sat_url
-
オーバークラウドノードを登録する Satellite サーバーのベース URL。このパラメーターには、HTTPS URL ではなく、Satellite の HTTP URL を使用します。たとえば、https://satellite.example.com ではなく http://satellite.example.com を使用します。オーバークラウドの作成プロセスではこの URL を使用して、どのサーバーが Red Hat Satellite 5 または Red Hat Satellite 6 サーバーであるかを判断します。Red Hat Satellite 6 サーバーの場合は、オーバークラウドは
katello-ca-consumer-latest.noarch.rpm
ファイルを取得してsubscription-manager
に登録し、katello-agent
をインストールします。Red Hat Satellite 5 サーバーの場合はオーバークラウドは、RHN-ORG-TRUSTED-SSL-CERT
ファイルを取得してrhnreg_ks
に登録します。 - rhel_reg_server_url
- 使用するサブスクリプションサービスのホスト名を指定します。デフォルトは、カスタマーポータルのサブスクリプション管理「subscription.rhn.redhat.com」です。このオプションを使用しない場合、システムはカスタマーポータルのサブスクリプション管理に登録されます。サブスクリプションサーバーの URL は、https://hostname:port/prefix の形式を使用します。
- rhel_reg_base_url
- 更新を受信するためのコンテンツ配信サーバーのホスト名を指定します。デフォルトは https://cdn.redhat.com です。Satellite 6 は独自のコンテンツをホストするため、URL は Satellite 6 で登録されているシステムに使用する必要があります。コンテンツのベース URL https://hostname:port/prefix の形式を使用します。
- rhel_reg_org
-
登録に使用する組織。この ID を特定するには、アンダークラウドノードから
sudo subscription-manager orgs
を実行します。プロンプトが表示されたら、Red Hat の認証情報を入力して、出力されるKey
値を使用します。 - rhel_reg_environment
- 選択した組織内で使用する環境
- rhel_reg_repos
- 有効化するリポジトリーのコンマ区切りリスト
- rhel_reg_activation_key
- 登録に使用するアクティベーションキー
- rhel_reg_user、rhel_reg_password
- 登録用のユーザー名およびパスワード。可能な場合には、登録用のアクティベーションキーを使用します。
- rhel_reg_machine_name
- マシン名。ノードのホスト名を使用するには、空欄のままにします。
- rhel_reg_force
-
登録のオプションを強制するには
true
に設定します (例:ノードの再登録時など)。 - rhel_reg_sat_repo
-
Red Hat Satellite 6 の管理ツール (
katello-agent
など) が含まれているリポジトリー。リポジトリー名が Red Hat Satellite のバージョンに対応した正しい名前であることを確認し、また Satellite サーバーと同期されていることをチェックします。たとえば、rhel-7-server-satellite-tools-6.2-rpms
は Red Hat Satellite 6.2 に対応します。
アップグレードのパラメーター
- UpdateOnRHELRegistration
-
True
に設定すると、登録が完了した後にオーバークラウドパッケージの更新がトリガーされます。デフォルトではFalse
に設定されます。
HTTP プロキシーのパラメーター
- rhel_reg_http_proxy_host
-
HTTP プロキシーのホスト名。例:
proxy.example.com
- rhel_reg_http_proxy_port
-
HTTP プロキシー通信用のポート。例:
8080
. - rhel_reg_http_proxy_username
- HTTP プロキシーにアクセスするためのユーザー名
- rhel_reg_http_proxy_password
- HTTP プロキシーにアクセスするためのパスワード
プロキシーサーバーを使用する場合には、 rhel_reg_http_proxy_host
パラメーターで定義されているホストへのルートが、全オーバークラウドノードにあることを確認してください。このホストへのルートがなければ、subscription-manager
がタイムアウトして、デプロイメントが失敗する原因となります。
デプロイメントコマンド (openstack overcloud deploy
) は、-e
オプションを使用して環境ファイルを追加します。~/templates/rhel-registration/environment-rhel-registration.yaml
と ~/templates/rhel-registration/rhel-registration-resource-registry.yaml
の両方を追加します。以下に例を示します。
$ openstack overcloud deploy --templates [...] -e /home/stack/templates/rhel-registration/environment-rhel-registration.yaml -e /home/stack/templates/rhel-registration/rhel-registration-resource-registry.yaml
登録は、OS::TripleO::NodeExtraConfig
Heat リソースとして設定されます。これは、このリソースを登録のみに使用できることを意味します。詳しくは、「事前設定: 特定のオーバークラウドロールのカスタマイズ」を参照してください。
5.2. 例 1: カスタマーポータルへの登録
以下の設定は、my-openstack
アクティベーションキーを使用してオーバークラウドノードを Red Hat カスタマーポータルに登録し、 1a85f9223e3d5e43013e3d6e8ff506fd
のプールをサブスクライブします。
parameter_defaults: rhel_reg_auto_attach: "" rhel_reg_activation_key: "my-openstack" rhel_reg_org: "1234567" rhel_reg_pool_id: "1a85f9223e3d5e43013e3d6e8ff506fd" rhel_reg_repos: "rhel-7-server-rpms,rhel-7-server-extras-rpms,rhel-7-server-rh-common-rpms,rhel-ha-for-rhel-7-server-rpms,rhel-7-server-openstack-12-rpms,rhel-7-server-rhceph-2-osd-rpms,rhel-7-server-rhceph-2-mon-rpms,rhel-7-server-rhceph-2-tools-rpms" rhel_reg_method: "portal" rhel_reg_sat_repo: "" rhel_reg_base_url: "" rhel_reg_environment: "" rhel_reg_force: "" rhel_reg_machine_name: "" rhel_reg_password: "" rhel_reg_release: "" rhel_reg_sat_url: "" rhel_reg_server_url: "" rhel_reg_service_level: "" rhel_reg_user: "" rhel_reg_type: "" rhel_reg_http_proxy_host: "" rhel_reg_http_proxy_port: "" rhel_reg_http_proxy_username: "" rhel_reg_http_proxy_password: ""
5.3. 例 2: Red Hat Satellite 6 サーバーへの登録
以下の設定は、my-openstack
アクティベーションキーを使用してオーバークラウドノードを Red Hat カスタマーポータルに登録し、 1a85f9223e3d5e43013e3d6e8ff506fd
のプールをサブスクライブします。この場合は、アクティベーションキーで有効化するレポジトリーも指定します。
parameter_defaults: rhel_reg_activation_key: "my-openstack" rhel_reg_org: "1" rhel_reg_pool_id: "1a85f9223e3d5e43013e3d6e8ff506fd" rhel_reg_method: "satellite" rhel_reg_sat_url: "http://sat6.example.com" rhel_reg_sat_repo: "rhel-7-server-satellite-tools-6.2-rpms" rhel_reg_repos: "" rhel_reg_auto_attach: "" rhel_reg_base_url: "" rhel_reg_environment: "" rhel_reg_force: "" rhel_reg_machine_name: "" rhel_reg_password: "" rhel_reg_release: "" rhel_reg_server_url: "" rhel_reg_service_level: "" rhel_reg_user: "" rhel_reg_type: "" rhel_reg_http_proxy_host: "" rhel_reg_http_proxy_port: "" rhel_reg_http_proxy_username: "" rhel_reg_http_proxy_password: ""
5.4. 例 3: Red Hat Satellite 5 サーバーへの登録
以下の設定は、my-openstack
アクティベーションキーを使用してオーバークラウドノードを sat5.example.com にある Red Hat Satellite 5 サーバーに登録し、サブスクリプションを自動的にアタッチします。この場合は、アクティベーションキーで有効化するレポジトリーも指定します。
parameter_defaults: rhel_reg_auto_attach: "" rhel_reg_activation_key: "my-openstack" rhel_reg_org: "1" rhel_reg_method: "satellite" rhel_reg_sat_url: "http://sat5.example.com" rhel_reg_repos: "" rhel_reg_base_url: "" rhel_reg_environment: "" rhel_reg_force: "" rhel_reg_machine_name: "" rhel_reg_password: "" rhel_reg_pool_id: "" rhel_reg_release: "" rhel_reg_server_url: "" rhel_reg_service_level: "" rhel_reg_user: "" rhel_reg_type: "" rhel_reg_sat_repo: "" rhel_reg_http_proxy_host: "" rhel_reg_http_proxy_port: "" rhel_reg_http_proxy_username: "" rhel_reg_http_proxy_password: ""
5.5. 例 4: HTTP プロキシーを介した登録
以下のサンプルパラメーターは、必要な登録方法向けの HTTP プロキシーの設定値を設定します。
parameter_defaults: ... rhel_reg_http_proxy_host: "proxy.example.com" rhel_reg_http_proxy_port: "8080" rhel_reg_http_proxy_username: "proxyuser" rhel_reg_http_proxy_password: "p@55w0rd!" ...
5.6. 高度な登録方法
一部の状況では、異なるサブスクリプションタイプに異なるロールを登録する必要がある場合があります。たとえば、コントローラーノードのみを OpenStack Platform サブスクリプションにサブスクライブして、Ceph Storage ノードを Ceph Storage サブスクリプションにするとします。本項では、ロールごとに別々のサブスクリプションを割り当てるのに役立つ高度な登録方法をいくつか紹介します。
設定フック
その 1 つとして、ロール固有のスクリプトを記述して、ロール固有のフックと共に追加する方法があります。たとえば、以下のスニペットを OS::TripleO::ControllerExtraConfigPre
リソースのテンプレートに追加することができます。これにより、コントローラーノードのみがサブスクリプションの情報を受け取ることになります。
ControllerRegistrationConfig: type: OS::Heat::SoftwareConfig properties: group: script config: str_replace: template: | #!/bin/sh sudo subscription-manager register --org 1234567 \ --activationkey "my-openstack" sudo subscription-manager attach --pool 1a85f9223e3d5e43013e3d6e8ff506fd sudo subscription-manager repos --enable rhel-7-server-rpms \ --enable rhel-7-server-extras-rpms \ --enable rhel-7-server-rh-common-rpms \ --enable rhel-ha-for-rhel-7-server-rpms \ --enable rhel-7-server-openstack-12-rpms \ --enable rhel-7-server-rhceph-2-mon-rpms \ ControllerRegistrationDeployment: type: OS::Heat::SoftwareDeployment properties: server: {get_param: server} config: {get_resource: ControllerRegistrationConfig} actions: ['CREATE','UPDATE'] input_values: deploy_identifier: {get_param: DeployIdentifier}
このスクリプトでは、一式の subscription-manager
コマンドを使用してシステムを登録し、サブスクリプションをアタッチして、必要なリポジトリーを有効化します。
フックについての詳しい情報は、「4章設定フック」を参照してください。
Ansible ベースの設定
director の動的インベントリースクリプトを使用して、特定のロールで Ansible ベース登録を実行することができます。たとえば、以下のプレイを使用してコントローラーノードを登録します。
--- - name: Register Controller nodes hosts: Controller become: yes vars: repos: - rhel-7-server-rpms - rhel-7-server-extras-rpms - rhel-7-server-rh-common-rpms - rhel-ha-for-rhel-7-server-rpms - rhel-7-server-openstack-12-rpms - rhel-7-server-rhceph-2-mon-rpms tasks: - name: Register system redhat_subscription: activationkey: my-openstack org_id: 1234567 pool_ids: 1a85f9223e3d5e43013e3d6e8ff506fd - name: Disable all repos command: "subscription-manager repos --disable *" - name: Enable Controller node repos command: "subscription-manager repos --enable {{ item }}" with_items: "{{ repos }}"
このプレイには、アクティベーションキーを使用したノードの登録、自動的に有効化されたリポジトリーの無効化、コントローラーノードに関連したリポジトリーのみの有効化の 3 つのタスクが含まれています。リポジトリーは repos
変数でリストされます。
オーバークラウドのデプロイ後には、以下のコマンドを実行して、Ansible がオーバークラウドに対して Playbook (ansible-osp-registration.yml
) を実行することができます。
$ ansible-playbook -i /usr/bin/tripleo-ansible-inventory ansible-osp-registration.yml
このコマンドは、動的インベントリースクリプトを実行して、ホストとそのグループの一覧を取得し、Playbook の hosts
パラメーターで定義されているグループ (この場合は Controller
グループ) 内のノードに、その Playbook のタスクを適用します。
オーバークラウドでの Ansible 自動化の実行に関する詳しい情報は、『director のインストールと使用方法』ガイドの「Ansible 自動化の実行」 を参照してください。