[Satellite6] How to set the right subscription for the provisioned VM Host when the Hypervisor has 2 Host-based subscription attached?

Solution Verified - Updated

Environment

Red Hat Satellite 6

Issue

  • When a new server is provisioned, its picking "OpenShift license" instead of "RHEL for SAP Applications for Virtual Datacenters with Smart Management"
    Both of the licenses are applied to the ESX server .. But We need the provisioned VM to pick "RHEL for SAP Applications for Virtual Datacenters with Smart Management"

Resolution

  • Apply into the Host Group (used to provision the VM) an Activation Key that has no subscription attach and "auto-attach" enabled/Yes.
    Note: If you have another activation key for custom and other subscriptions, add them in the format "ak1,ak2" where ak1 is the first
    activation key that has empty subscription and "auto-attach" enabled/Yes. ak2 the second activation key with "auto-attach" disabled/No.

    • Copy the product certificate file of Red Hat product (eg. SAP Applications 146.pem) to /etc/pki/product folder of the Host to be provisioned.
      This can be done either by:
      a. Copying the certificate file from VMware side when the Host is rebooted after provisioning but before registration.
      b. Create a provisioning template/snippet containing the product certificate file and call this snippet from "redhat_register" (or cloned equivalent) snippet before registration command:
subscription-manager register --name="<%= @host.name %>" --org='<%= subscription_manager_org %>' --activationkey='<%= activation_key %>'

Example:

On cloned 'redhat_register_RHEL_Host' snippet, add 7 lines as shown:

<% if activation_key == 'Dev RHEL7' || 'Prod RHEL7 || 'QA RHEL7' %> 
  <%= save_to_file('/etc/pki/product/146.pem',
                    snippet('sap_vdc_product_cert')) %>
  restorecon -Rv /etc/pki/product
  chown root.root 644 /etc/pki/product/146.pem
  chmod 644 /etc/pki/product/146.pem
<% end -%>
subscription-manager register --name="<%= @host.name %>" --org='<%= subscription_manager_org %>' --activationkey='<%= activation_key %>'      <----- add 7 lines above this line
  • The product pem file (example here 146.pem) has to be copied to the the snippet "sap_vdc_product_cert":
<%#
kind: snippet
name: sap_vdc_product_cert
model: ProvisioningTemplate
snippet: true
-%>
-----BEGIN CERTIFICATE-----
MIIGGjCCBAKgAwIBAgIJALDxRLt/tWEwMA0GCSqGSIb3DQEBBQUAMIGuMQswCQYD
VQQGEwJVUzEXMBUGA1UECAwOTm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IVE8C
AwEAAaOBozCBoDAJBgNVHRMEAjAAMDIGDCsGAQQBkggJAYESAQQiDCBSZWQgSGF0
IEVudGVycHJpc2UgTGludXggZm9yIFNBUDAVBgwrBgEEAZIICQGBEgIEBQwDNy42
MBgGDCsGAQQBkggJAYESAwQIDAZ4ODZfNjQwLgYMKwYBBAGSCAkBgRIEBB4MHHJo
ZWwtNy1zYXAscmhlbC03LXNlcnZlci1zYXAwDQYJKoZIhvcNAQEFBQADggIBAHH6
ui2kXvTanLQ/eTttbPVh/8eLtqbueagCFhXjuudR8EtvlIhXcn6odjAzooPzdHU+
5vfBcBWZorqABZQPZ8hGvZJOmKkyoFCNI5qhAHJEAlGDb4FeN8qlGMwJCH/9SI2j
Iqxur2L8nTk3gkQblYhzVUA9mZRotA06t2xpOAZYEOkmIfdfdvbNcRLQG3oxnpop
RJ947D5M6A5EeUPL5VcVUmYYuhFDDjOBIWpDS8eFdr5HW23dErLtPgoqOxWvT0Jy
lnfEWVgF+Tj0BosulXbS+UheOJp2MmdOPmkkWeic3rQ3xEmbhyOfBr8NgeOe01PK
Amb6hOPTY1TMKSQoFpyLMHz33uW92jURKoJBXRdlJBlzHvl8wSRRSxshC0c0aqxS
X2Kch4IwWrsUxJR3y7o8d04P9QB0KswmbCbBoRRao+MFwFd4AKPXnPTu66jzxpDn
ESrhuirFg65IvglHiqZbtgaInXEPFG9tC/6vJuu292BETgNELqtYuGmMiDr46La4
UyfPn7EstmxWCssld4rhPY7F8BxHYOU7UZafl6WdX7caQOymNXA4mbLDbgQOVAYk
BMbNKZ7zLmlZM5TOXpJipzsfrADxoj9AxyjlfnCNXhtwXwAYrqXlFggFKqpwS9lc
w0GwFM/lij9aZNqyV3jxchaqplHGHhB6izSHAkTl
-----END CERTIFICATE-----

For more KB articles/solutions related to Red Hat Satellite 6.x Provisioning Issues, please refer to the Consolidated Troubleshooting Article for Red Hat Satellite 6.x Provisioning related Issues

Root Cause

  • In normal used-case scenario, a Hypervisor only have 1 Host-based Red Hat subscription attach, example "Red Hat Enterprise Linux for Virtual Datacenter". The virtual guest running on this Hypervisor can pick-up the correct temporary guest subscription and will be assigned the correct subscription once virt-who does the Host/Guest mapping of the newly added guest.
  • If the Hypervisor is attached with 2 Host-based Red Hat subscription (eg. "Red Hat Enterprise Linux for SAP Applications for Virtual Datacenter" and "Red Hat OpenShift Container Platform Broker/Master Infrastructure") the provisioned Host will randomly pick up either of the 2 Hypervisor subscription (there isn't rules on that time). Adding the product certificate file of the subscription that you want the provisioned Host to consume will assign the correct temporary subscription right after provisioning.
SBR
Product(s)
Category

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.