Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redhat_subscription always return changed status #226

Open
tinsjourney opened this issue Apr 23, 2020 · 12 comments
Open

Redhat_subscription always return changed status #226

tinsjourney opened this issue Apr 23, 2020 · 12 comments
Labels
bug This issue/PR relates to a bug module module

Comments

@tinsjourney
Copy link

SUMMARY

Since ansible Version 2.9.5 and PR #66478, redhat_subscription status is always changed even is host is already registered with RHN

ISSUE TYPE
  • Bug Report
COMPONENT NAME

redhat_subscription

ANSIBLE VERSION
ansible 2.9.7
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/home/tinsjourney/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3.6/site-packages/ansible
  executable location = /usr/bin/ansible
  python version = 3.6.8 (default, Oct 11 2019, 15:04:54) [GCC 8.3.1 20190507 (Red Hat 8.3.1-4)]
CONFIGURATION
N/A
OS / ENVIRONMENT

Red Hat 8.1

STEPS TO REPRODUCE
[tinsjourney@labs ~]$ cat redhat_subscription.yaml
- name: Register Host to RHN
  hosts: all
  become: true
  vars:
    ansible_user: root

  tasks:
  - name: Register host to RHN
    redhat_subscription:
      state: present
      username: "my_username"
      password: "my_password"
      pool_ids: 0123456789abcdef0123456789abcdef
EXPECTED RESULTS
[tinsjourney@labs ~]$ ansible-playbook -i rhosp16-registry, redhat_subscription.yaml

PLAY [Register Host to RHN] ************************************************************************************************************

TASK [Gathering Facts] *****************************************************************************************************************
ok: [rhosp16-registry]

TASK [Register host to RHN] ***********************************************************************************************************
ok: [rhosp16-registry]

PLAY RECAP ****************************************************************************************************************************
rhosp16-registry           : ok=3    changed=0    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0
ACTUAL RESULTS
[tinsjourney@labs ~]$ ansible-playbook -i rhosp16-registry, redhat_subscription.yaml

PLAY [Register Host to RHN] ************************************************************************************************************

TASK [Gathering Facts] *****************************************************************************************************************
ok: [rhosp16-registry]

TASK [Register host to RHN] ***********************************************************************************************************
changed: [rhosp16-registry]

PLAY RECAP ****************************************************************************************************************************
rhosp16-registry           : ok=2    changed=1    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0
@ansibullbot
Copy link
Collaborator

Files identified in the description:

If these files are inaccurate, please update the component name section of the description or use the !component bot command.

click here for bot help

@ansibullbot ansibullbot added affects_2.10 bug This issue/PR relates to a bug module module labels Apr 23, 2020
@russoz
Copy link
Collaborator

russoz commented Aug 14, 2021

Hi @tinsjourney ,

Thank you for your contribution in making this colleciton even better!

Please notice that this collection is supported for Ansible 2.9.10 onwards, and even so, only critical security fixes will be applied on the Ansible 2.9 branch. Thus, this issue should be checked against ansible-base 2.10.x or, preferably, against ansible-core 2.11.x to ensure the problem has not been fixed yet. Thanks in advance!

Cheers!

@felixfontein
Copy link
Collaborator

needs_info

@ansibullbot ansibullbot added the needs_info This issue requires further information. Please answer any outstanding questions label Aug 15, 2021
@tinsjourney
Copy link
Author

Hi @russoz,

I tried with ansible-core 2.11.3, and I have the same behavior, always return changed.

❯ ansible --version
ansible [core 2.11.3]
  config file = None
  configured module search path = ['/Users/tins/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/Cellar/ansible/4.4.0/libexec/lib/python3.9/site-packages/ansible
  ansible collection location = /Users/tins/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/local/bin/ansible
  python version = 3.9.6 (default, Jun 29 2021, 05:25:02) [Clang 12.0.5 (clang-1205.0.22.9)]
  jinja version = 3.0.1
  libyaml = True

❯ ansible-playbook -i rhosp16-registry, redhat_subscription.yaml

PLAY [Register Host to RHN] *******************************************************************************************************************

TASK [Gathering Facts] *******************************************************************************************************************
ok: [rhosp16-registry]

TASK [Register host to RHN] ******************************************************************************************************************
changed: [rhosp16-registry]

PLAY RECAP ******************************************************************************************************************
rhosp16-registry              : ok=2    changed=1    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0

❯ ansible-playbook -i rhosp16-registry, redhat_subscription.yaml

PLAY [Register Host to RHN] *************************************************************************************

TASK [Gathering Facts] *******************************************************************************************************************
ok: [rhosp16-registry]

TASK [Register host to RHN] *******************************************************************************************************************
changed: [rhosp16-registry]

PLAY RECAP *******************************************************************************************************************
rhosp16-registry             : ok=2    changed=1    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0

@ansibullbot ansibullbot removed the needs_info This issue requires further information. Please answer any outstanding questions label Aug 24, 2021
@ansibullbot
Copy link
Collaborator

Files identified in the description:

If these files are incorrect, please update the component name section of the description or use the !component bot command.

click here for bot help

@ptoscano
Copy link
Contributor

It looks to me that this issue is an "older copy" of #5313, which was fixed few months ago, and backported to some older branches:

@tinsjourney can you please check again with any of the fixed versions mentioned above?

@ptoscano
Copy link
Contributor

Also, another thing to check is whether the account uses SCA (Simple Content Access) or not -- you can easily do that by checking the output of subscription-manager status, which will show something like

Overall Status: Disabled
Content Access Mode is set to Simple Content Access. This host has access to content, regardless of subscription status.

for an SCA account.

In case of SCA, individual subscriptions and pools don't apply, so specified pool_ids would always be considered as "not consumed", and the module would try to attach to them (and subscription-manager in 8.7+ and 9.1+ ignores them).

@ansibullbot
Copy link
Collaborator

@ptoscano
Copy link
Contributor

!component redhat_subscription
-label affects_2.9

@ptoscano
Copy link
Contributor

!component redhat_subscription

@felixfontein
Copy link
Collaborator

@ptoscano the component has already been set correctly, there's no need to try it again. (That's also why the bot doesn't seem to react.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue/PR relates to a bug module module
Projects
None yet
Development

No branches or pull requests

5 participants