4.5. 使用 cloud-init 管理红帽订阅
您可以使用 rh_subscription
指令注册您的系统。对于每个订阅,您需要编辑用户数据。以下步骤提供了一些您可以使用 rh_subscription
指令进行更改的示例。
步骤
要使用
auto-attach
和service-level
选项,请执行以下步骤:在
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
下,添加您的用户名
、密码
、server-hostname
,并将auto-attach
设置为True
。rh_subscription: username: sample@redhat.com password: 'password' server-hostname: test.example.com auto-attach: True