Chapter 8. Managing Red Hat subscriptions with cloud-init
You can use the rh_subscription
directive to register your system. For each subscription, you need to edit user data.
Example 1
You can use the
auto-attach
andservice-level
options:Under
rh_subscription
, add yourusername
andpassword
, setauto-attach
toTrue
, and setservice-level
toself-support
.rh_subscription: username: sample@redhat.com password: 'mypassword' auto-attach: True service-level: self-support
rh_subscription: username: sample@redhat.com password: 'mypassword' auto-attach: True service-level: self-support
Copy to Clipboard Copied! NoteThe
service-level
option requires that you use theauto-attach
option.
Example 2
You can use the
activation-key
andorg
options:Under
rh_subscription
, add youractivation key
andorg
number and setauto-attach
toTrue
.rh_subscription: activation-key: example_key org: 12345 auto-attach: True
rh_subscription: activation-key: example_key org: 12345 auto-attach: True
Copy to Clipboard Copied!
Example 3
You can add a subscription pool:
Under
rh_subscription
, add yourusername
,password
, and pool number.rh_subscription: username: sample@redhat.com password: 'password' add-pool: XYZ01234567
rh_subscription: username: sample@redhat.com password: 'password' add-pool: XYZ01234567
Copy to Clipboard Copied! NoteThis sample is the equivalent of the
subscription-manager attach --pool=XYZ01234567
command.
Example 4
You can set a server host name in the
/etc/rhsm/rhsm.conf
file:Under
rh_subscription
, add yourusername
,password
,server-hostname
, and setauto-attach
toTrue
.rh_subscription: username: sample@redhat.com password: 'password' server-hostname: test.example.com auto-attach: True
rh_subscription: username: sample@redhat.com password: 'password' server-hostname: test.example.com auto-attach: True
Copy to Clipboard Copied!