ansible-collections / community.general

Ansible Community General Collection
https://galaxy.ansible.com/ui/repo/published/community/general/
GNU General Public License v3.0
814 stars 1.49k forks source link

redhat_subscription fails when Satellite uses Simple Content Access #715

Open Rikairchy opened 4 years ago

Rikairchy commented 4 years ago
SUMMARY

When using redhat_subscription to register hosts with Red Hat Satellite using Simple Content Access, subscription_manager fails with the error "Unable to find available subscriptions for all your installed products."

ISSUE TYPE
COMPONENT NAME

redhat_subscription

ANSIBLE VERSION
ansible 2.9.10
  config file = None
  configured module search path = ['/home/mattr/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python3.8/dist-packages/ansible
  executable location = /usr/local/bin/ansible
  python version = 3.8.2 (default, Jul 16 2020, 14:00:26) [GCC 9.3.0]
CONFIGURATION
mattr@controller:~$ ansible-config dump --only-changed
mattr@controller:~$
OS / ENVIRONMENT

Controller: Red Hat Enterprise Linux 7.8 Targets: Red Hat Enterprise Linux 7.8

STEPS TO REPRODUCE
---
- name: Sub to Sat
  hosts: all
  become: "True"

  tasks:
    - name: Subscribe
      redhat_subscription:
        activationkey: "{{ activation_key }}"
        org_id: "{{ org_name }}"
EXPECTED RESULTS
changed: [TARGET_HOST] => {"changed": true, "msg": "System successfully registered to 'https://satellite.mydomain.tld'.", "subscribed_pool_ids": []}
ACTUAL RESULTS
fatal: [TARGET_HOST]: FAILED! => {
    "changed": false,
    "cmd": "/sbin/subscription-manager register --org MYORGNAME--activationkey VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
    "invocation": {
        "module_args": {
            "activationkey": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
            "auto_attach": null,
            "consumer_id": null,
            "consumer_name": null,
            "consumer_type": null,
            "environment": null,
            "force_register": false,
            "org_id": "MYORGNAME",
            "password": null,
            "pool": "^$",
            "pool_ids": [],
            "release": null,
            "rhsm_baseurl": null,
            "rhsm_repo_ca_cert": null,
            "server_hostname": null,
            "server_insecure": null,
            "server_proxy_hostname": null,
            "server_proxy_password": null,
            "server_proxy_port": null,
            "server_proxy_user": null,
            "state": "present",
            "syspurpose": null,
            "username": null
        }
    },
    "msg": "",
    "rc": 1,
    "stderr": "",
    "stderr_lines": [],
    "stdout": "The system has been registered with ID: <UUID>\nThe registered system name is: rheltemplate\nInstalled Product Current Status:\nProduct Name: Red Hat Enterprise Linux Server\nStatus:       Not Subscribed\n\nUnable to find available subscriptions for all your installed products.\n",
    "stdout_lines": [
        "The system has been registered with ID: <UUID>",
        "The registered system name is: rheltemplate",
        "Installed Product Current Status:",
        "Product Name: Red Hat Enterprise Linux Server",
        "Status:       Not Subscribed",
        "",
        "Unable to find available subscriptions for all your installed products."
    ]
}
TEMPORARY WORKAROUND
---
- name: Sub to Sat
  hosts: all
  become: "True"

  tasks:
    - name: Subscribe
      redhat_subscription:
        activationkey: "{{ activation_key }}"
        org_id: "{{ org_name }}"
      register: rhsm_output
      failed_when: "'The system has been registered' not in rhsm_output.stdout"
Rikairchy commented 4 years ago

If a host is removed from Satellite and re-subscribed, the workaround is not required. Testing this issue with three machines that were previously enrolled in this instance of Satellite did not result in errors. Adding a fourth VM that has not subscribed to this Satellite instance previously failed with the above error. This bug occurs only during the initial registration of a machine to Satellite using SCA.

ansibullbot commented 4 years ago

cc @alikins @barnabycourt @kahowell click here for bot help

Rikairchy commented 4 years ago

bot_status

ansibullbot commented 4 years ago
Components plugins/modules/packaging/os/redhat_subscription.py support: core maintainers: alikins barnabycourt kahowell
Metadata **waiting_on**: maintainer [needs_info](https://github.com/ansible/ansibullbot/blob/master/ISSUE_HELP.md#label-needs_info): False

click here for bot help

ansibullbot commented 1 year ago

cc @cnsnyder @ptoscano click here for bot help