Registering systems using subscription-manager during a kickstart install in RHEL - Tips from BJ Walker, GSS Red Hatter of the Week
With the release of Red Hat Subscription Manager (RHSM), Red Hat has moved to a certificate based registration which is designed to streamline the process of registering RHEL systems and allow easy management of entitlements and registered systems. Many customers have moved their entitlement handling over to RHSM with great success however with the addition of RHSM, the process to register systems via kickstart in RHEL has changed a bit. While different this process can still be completely successfully using a short %post script in the kickstart file. Below is an excerpt from one of my kickstarts used to install a RHEL 6 system and register it to RHSM:
%post
# This is done here in the post section, after the system has completed install and before a reboot
/usr/sbin/subscription-manager register --username customer_portal_username --password customer_portal_password --autosubscribe
Using the "autosubscribe" option above this will allow the system to automatically apply the most relevant and applicable entitlement to this system based on what is available from the account tied to this login information.
If you desire to have the system in question registered to entitlements only tied to specific support levels you can opt to also include the "servicelevel" option by appending that option as follows:
%post
# This is done here in the post section, after the system has completed install and before a reboot
/usr/sbin/subscription-manager register --servicelevel=LEVEL --username customer_portal_username --password customer_portal_password --autosubscribe
Here you can append STANDARD, NONE, PREMIUM, or SELF SUPPORT. This will instruct RHSM to only subscribe to the appropriate level based on the support need for this system.
The "subscription-manager" command has an abundance of options that can be used the modify/manipulate the exact registration needed for any system. For more information and a full list of options see the manpage for "subscription manager" by doing "man subscription-manager" from any installed RHEL system that has the "subscription-manager" package installed.