I think I have fixed it - see the last few lines incase of tl;dr. I put
some details about my config which may help someone in the same situation
and may help adjust the defaults shipped with Foreman/Katello. I use
activation keys so --auto-attach is not allowed with register using keys.
Here was the subscription-manager from the snippet :
echo "Registering the System"
subscription-manager register --org="<%= @host.rhsm_organization_label %>"
–name="<%= @host.name %>" --activationkey="<%=
@host.params['kt_activation_keys'] %>"
<% if @host.operatingsystem.name == "RedHat" %>
add the rhel rpms to install katello agent
subscription-manager repos --disable=*
subscription-manager repos --enable=rhelserver-rpms
–enable=MyOrg_Puppet_Labs_ --enable=MyOrg_Katello_Client*
–enable=MyOrg_EPEL*
<% end %>
I added --auto-attach to subscription-manager register
but in the log :
Error: Activation keys cannot be used with --auto-attach.
After the system is built, I can use subscription-manager register with
–auto-attach and my user/pass to register the host and get the temporary
guest subscription. This may be unrelated, but my activation key is for
Environment : Prod, but when using my user/pass after the host is built,
the only env I can use is Library
subscription-manager register --org="MyOrg" --name="hostname.myorg.org"
–auto-attach --force
Username: ME
Password:
Environment: Prod
No such environment: Prod
[root@host ~]# subscription-manager register --org="MyOrg"
–name="hostname.myorg.org" --auto-attach --force
Username: ME
Password:
Environment: Library
The system has been registered with ID: <id>
Installed Product Current Status:
Product Name: Red Hat Enterprise Linux Server
Status: Partially Subscribed
Changing my subscription-manager registration snipped to include this
worked - register and attach are two separate commands instead of
–auto-attach in the register line :
echo "Registering the System"
subscription-manager register --org="<%= @host.rhsm_organization_label %>"
–name="<%= @host.name %>" --activationkey="<%=
@host.params['kt_activation_keys'] %>"
subscription-manager attach --auto
<% if @host.operatingsystem.name == "RedHat" %>
add the rhel rpms to install katello agent
subscription-manager repos --disable=*
subscription-manager repos --enable=rhelserver-rpms
–enable=MyOrg_Puppet_Labs_ --enable=MyOrg_Katello_Client*
–enable=MyOrg_EPEL*
<% end %>
Thanks for your help Tom - you got me on the right track.
···
On Monday, June 8, 2015 at 9:54:24 AM UTC-5, Tom McKay wrote:
>
>
> Can you paste the subscription-manager command being called during
> provisioning? The --auto-attach flag to register should pick up the
> temporary guest subscription.
>