Skip to content

redhat_subscription module is not idempotent when pool_ids are used #5313

@cfiehe

Description

@cfiehe

Summary

When you provide some pool_ids, the module reports a change every time when it runs. The current entitements get removed and recreated afterwards:

- name: subscription | Ensure subscription
  community.general.redhat_subscription:
    state: present
    username: joe_user
    password: somepass
    pool_ids: 0123456789abcdef0123456789abcdef

Every run results in

TASK [rhsm : subscription | Ensure subscription] *************************
changed: [molecule-rhel-9.<my_company>]

Issue Type

Bug Report

Component Name

redhat_subscription

Ansible Version

$ ansible --version
ansible [core 2.13.3]
  config file = None
  configured module search path = ['/home/ansible/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/ansible/.local/lib/python3.10/site-packages/ansible
  ansible collection location = /home/ansible/.ansible/collections:/usr/share/ansible/collections
  executable location = /home/ansible/.local/bin/ansible
  python version = 3.10.6 (main, Aug 10 2022, 11:40:04) [GCC 11.3.0]
  jinja version = 3.0.3
  libyaml = True

Community.general Version

$ ansible-galaxy collection list community.general
Collection        Version
----------------- -------
community.general 5.5.0

Configuration

$ ansible-config dump --only-changed
$

OS / Environment

RHEL 9

Steps to Reproduce

---
- hosts: localhost
  tasks:
  - name: subscription | Ensure subscription
    community.general.redhat_subscription:
      state: present
      username: joe_user
      password: somepass
      pool_ids: 0123456789abcdef0123456789abcdef

Expected Results

After the system has been registered and properly subscribed, the module should report no further change an keep the current entitlements untouched.

Actual Results

TASK [rhsm : subscription | Ensure subscription] *************************
changed: [molecule-rhel-9.<my_company>]

Code of Conduct

  • I agree to follow the Ansible Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions