# redhat-subscription causing issues?

**URL:** <https://forum.ansible.com/t/redhat-subscription-causing-issues/21064>\
**Category:** Ansible Project\
**Tags:** rhel\
**Created:** [April 4, 2016, 10:36pm UTC](https://forum.ansible.com/t/redhat-subscription-causing-issues/21064 "2016-04-04T22:36:58Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Adam\_Morris](https://avatars.discourse-cdn.com/v4/letter/a/ecae2f/32.png) [@Adam\_Morris](https://forum.ansible.com/u/Adam_Morris)\
**Post date:** [April 4, 2016, 10:36pm UTC](https://forum.ansible.com/t/redhat-subscription-causing-issues/21064/1 "2016-04-04T22:36:58Z")

</div>

Greetings,

I have been using Ansible for a while now and one of my playbooks for configuring servers includes this…

- name: Register a Redhat system (\>= RHEL 6)  
redhat\_subscription: state=present username= password=  
pool=‘\ARedHat Enterprise Server\Z’ autosubscribe=true  
when: ansible\_distribution == “RedHat” and ansible\_distribution\_version \>= “6.0”

- name: make sure yum-utils is installed  
raw: yum -y install yum-utils  
when: ansible\_os\_family == “RedHat”

This was working perfectly, but recently I have been getting errors like this…

TASK [common : Register a Redhat system (\>= RHEL 6)] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

ok: [u90324]

TASK [common : make sure yum-utils is installed] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

fatal: [u90324]: FAILED! =\> {“changed”: false, “failed”: true, “rc”: 1, “stderr”: “”, “stdout”: “Loaded plugins: langpacks, product-id, subscription-manager\r\nThis system is registered to Red Hat Subscription Management, but is not receiving updates. You can use subscription-manager to assign subscriptions.\r\nThere are no enabled repos.\r\n Run "yum repolist all" to see the repos you have.\r\n You can enable repos with yum-config-manager --enable \r\n”, “stdout\_lines”: [“Loaded plugins: langpacks, product-id, subscription-manager”, “This system is registered to Red Hat Subscription Management, but is not receiving updates. You can use subscription-manager to assign subscriptions.”, “There are no enabled repos.”, " Run "yum repolist all" to see the repos you have.“, " You can enable repos with yum-config-manager --enable ”]}

I think that this might be an issue with subscription manager rather than Ansible, but has anyone else seen this or is this just my problem? I am wondering whether RedHat has broken auto-attach… Probably time to break out the VM and test this all again.

Thanks,

Adam

---

<div class="post-metadata">

**Author:** ![alikins](https://avatars.discourse-cdn.com/v4/letter/a/d07c76/32.png) [@alikins](https://forum.ansible.com/u/alikins)\
**Post date:** [April 5, 2016, 9:11pm UTC](https://forum.ansible.com/t/redhat-subscription-causing-issues/21064/2 "2016-04-05T21:11:57Z")

</div>

It does sound like the system isn’t attached to any subscription pools, which likely means  
auto-attach failed (or possibly, if it was working before, that a subscription expired).

/var/log/rhsm/rhsm.log on that system should indicate if there was a failure. Also just  
checking ‘subscription-manager list’ or ‘subscription-manager repos --list-enabled’ to  
see if it’s registered but not attached (‘subscribed’) or if it’s registered+subscribed but  
missing applicable repos.

Oh, and if that’s a direct cut of the playbook, the pool name may be wrong  
[ ‘RedHat Enterprise Server’ vs ‘Red Hat Enterprise Linux Server’ etc)

---

<div class="post-metadata">

**Author:** ![Adam\_Morris](https://avatars.discourse-cdn.com/v4/letter/a/ecae2f/32.png) [@Adam\_Morris](https://forum.ansible.com/u/Adam_Morris)\
**Post date:** [April 5, 2016, 11:43pm UTC](https://forum.ansible.com/t/redhat-subscription-causing-issues/21064/3 "2016-04-05T23:43:37Z")

</div>

You sir, are a Genius…

Your employer however irks me…

Yes, that was an exact excerpt from the playbook. And yes, the pool name was wrong. But the playbook USED to work and I got that pool name from Red Hat Subscription Manager a while back. Not only that, but that pool name is used in the examples in the Ansible documentation (proof to me that I wasn’t imagining it)… So I suspect that at some point in the last month or so Red Hat changed the name of the pool. (Or fixed it so that the wrong name would no longer work).

Anyway…

Thank you for your assistance.

Adam

---

<div class="post-metadata">

**Author:** ![Greg\_DeKoenigsberg1](https://avatars.discourse-cdn.com/v4/letter/g/838e76/32.png) [@Greg\_DeKoenigsberg1](https://forum.ansible.com/u/Greg_DeKoenigsberg1)\
**Post date:** [April 6, 2016, 12:22am UTC](https://forum.ansible.com/t/redhat-subscription-causing-issues/21064/4 "2016-04-06T00:22:50Z")

</div>

Do we need to change the module docs?

---

<div class="post-metadata">

**Author:** ![Adam\_Morris](https://avatars.discourse-cdn.com/v4/letter/a/ecae2f/32.png) [@Adam\_Morris](https://forum.ansible.com/u/Adam_Morris)\
**Post date:** [April 6, 2016, 12:37am UTC](https://forum.ansible.com/t/redhat-subscription-causing-issues/21064/5 "2016-04-06T00:37:17Z")

</div>

Greg,  
It wouldn’t hurt to fix them, it might be better to also add a comment “Pool ids shown are examples. Available pools can be seen with the following command.”

Should I go do that and submit a pull request?

Adam

---

<div class="post-metadata">

**Author:** ![Greg\_DeKoenigsberg1](https://avatars.discourse-cdn.com/v4/letter/g/838e76/32.png) [@Greg\_DeKoenigsberg1](https://forum.ansible.com/u/Greg_DeKoenigsberg1)\
**Post date:** [April 6, 2016, 12:40am UTC](https://forum.ansible.com/t/redhat-subscription-causing-issues/21064/6 "2016-04-06T00:40:06Z")

</div>

That would be great. Ping me in the pr (@gregdek).

---

<div class="post-metadata">

**Author:** ![alikins](https://avatars.discourse-cdn.com/v4/letter/a/d07c76/32.png) [@alikins](https://forum.ansible.com/u/alikins)\
**Post date:** [April 6, 2016, 4:58pm UTC](https://forum.ansible.com/t/redhat-subscription-causing-issues/21064/7 "2016-04-06T16:58:42Z")

</div>

inline...

> From: "Adam Morris" \<zwack.am@gmail.com\>  
> Subject: Re: [ansible-project] Re: redhat-subscription causing issues?

> Greg,  
> It wouldn't hurt to fix them, it might be better to also add a comment "Pool  
> ids shown are examples. Available pools can be seen with the following  
> command."

\<Red Hat Subscription Manager pedantry follows\>

The examples currently shown in the docs aren't actually pool ids, just regexes  
to match against either the product name or subscription name associated with a  
pool. The plugin uses that to find a pool id (something like '8a99f984514f448401515a0392042528').

Pools and pool ids are kind of a weird concept though, since they are unique globally  
(and potentially N:N with subscriptions and orders). It allows a fine level of  
granularity and flexibility when attaching pools. But unfortunately pool ids  
are almost never useful for DWIM scenarios, hence the redhat\_subscriptions modules  
code for regex matching on the names (and subman's list --match= options). Auto  
attach will generally DWIM, except when it doesn't, which isn't particular idempotent.  
[current module does take lengths to preserve existing state though...]

\</\>

I see a couple of minor oddities in the module now. I'll get an issue in about it.
