4.5. cloud-init を使用した Red Hat サブスクリプションの管理
rh_subscription ディレクティブを使用してシステムを登録できます。サブスクリプションごとに、ユーザーデータを編集する必要があります。以下の手順では、rh_subscription ディレクティブを使用して加えることのできる変更の例をいくつか示します。
手順
自動アタッチオプションとサービスレベルオプションを使用するには、次の手順を実行します。rh_subscriptionの下にusernameとpasswordを追加して、auto-attachをTrueに設定し、service-levelをself-supportに設定します。rh_subscription: username: sample@redhat.com password: 'mypassword' auto-attach: True service-level: self-support注記service-levelオプションでは、auto-attachオプションを使用する必要があります。activation-keyおよびorgオプションを使用するには、以下の手順を実行します。rh_subscriptionの下にactivation keyとorgの番号を追加し、auto-attachをTrueに設定します。rh_subscription: activation-key: example_key org: 12345 auto-attach: Trueサブスクリプションプールを追加するには、以下の手順を実行します。
rh_subscriptionの下に、username、password、およびプール番号を追加します。rh_subscription: username: sample@redhat.com password: 'password' add-pool: XYZ01234567注記このサンプルは、
subscription-manager attach --pool=XYZ01234567コマンドに相当します。/etc/rhsm/rhsm.confファイルでサーバーのホスト名を設定するには、以下の手順を実行します。rh_subscriptionの下にusername、password、server-hostnameを追加し、auto-attachをTrueに設定します。rh_subscription: username: sample@redhat.com password: 'password' server-hostname: test.example.com auto-attach: True