Feature #18647

Support conditional activation keys

Added by Klaas D over 3 years ago. Updated over 2 years ago.

Needs design
Activation Key
Target version:
Bugzilla link:
Pull request:
Fixed in Releases:
Found in Releases:


I've been talking with jsherrill on irc about a problem I have, he suggested opening this feature request, in general this could be fixed by having the possibility to select activation keys for server based on certain things you set in host or hostgroup - these would be content view and lifecycle environment. But maybe we can think a little about what we want to achieve in general with activation keys.

The problem is that at the moment you (can) set lifecycle environment and content view in both the host (or hostgroup/...) and inside the activation key. when you use both the activation key always wins.

Real World Example:
Lifecycle Environments: Library -> Dev -> Prod
Content View: cv_RHEL7 (in all 3 environments)
Activation Key: ak_RHEL7 (Subscription with Lifecycle Environment Library and Content View cv_RHEL7)
Hostgroup: hg_RHEL7 (this includes Puppet Classes/Parameters, Network, OS and Activation Key ak_RHEL7)

Now when I install a server via gui it always ends up in the lifecycle environment and content view of the activation key. I can't install a server into a different lifecycle environment without either creating a new host group or overwriting the activation key manually.

Ideas that could solve this problem:
  • Host group/host can overwrite lifecycle environment and content view set by activation key
  • Activation key gets set conditionally in host group
  • Host group/host don't handle lifecycle environment and content view, activation keys set them
  • Activation Keys don't handle lifecycle environment and content view, host group/host set them

In general I'm not sure why we set lifecycle environemnt and content view at two places :)

Workaround I'm implementing now:
My activation keys are a combination of content view and lifecycle environment and I don't use the activation key set via hostgroups/hosts. In my snippet the registration looks like this:

subscription-manager register --org="<%= @host.rhsm_organization_label %>" --name="<%= %>" --activationkey="<%= @host.content_view %>-<%= @host.lifecycle_environment %>" 

I only use one activation key but if you need more you can conditionally add @host.params['kt_activation_keys'] if you want :)



#1 Updated by Eric Helms over 3 years ago

  • Status changed from New to Needs design
  • Legacy Backlogs Release (now unused) set to 114

#2 Updated by Klaas D over 3 years ago

I recently had to add additional activation keys for a custom product that is only needed on a couple of servers, my workaround can be extented like I suggested:

<% if @host.params['kt_activation_keys'] %>
subscription-manager register --org="<%= @host.rhsm_organization_label %>" --name="<%= %>" --activationkey="<%= @host.content_view %>-<%= @host.lifecycle_environment %>,<%= @host.params['kt_activation_keys'] %>" 
<% else -%>
subscription-manager register --org="<%= @host.rhsm_organization_label %>" --name="<%= %>" --activationkey="<%= @host.content_view %>-<%= @host.lifecycle_environment %>" 
<% end %>

or you could even put it into one line :)


Also available in: Atom PDF