{"action":"opened","issue":{"url":"https://api.github.com/repos/ansible/ansible/issues/50502","repository_url":"https://api.github.com/repos/ansible/ansible","labels_url":"https://api.github.com/repos/ansible/ansible/issues/50502/labels{/name}","comments_url":"https://api.github.com/repos/ansible/ansible/issues/50502/comments","events_url":"https://api.github.com/repos/ansible/ansible/issues/50502/events","html_url":"https://github.com/ansible/ansible/issues/50502","id":395636580,"node_id":"MDU6SXNzdWUzOTU2MzY1ODA=","number":50502,"title":"redhat_subscription ignores consumer_name if activationkey is specified","user":{"login":"rob-parker-geo","id":10462105,"node_id":"MDQ6VXNlcjEwNDYyMTA1","avatar_url":"https://avatars2.githubusercontent.com/u/10462105?v=4","gravatar_id":"","url":"https://api.github.com/users/rob-parker-geo","html_url":"https://github.com/rob-parker-geo","followers_url":"https://api.github.com/users/rob-parker-geo/followers","following_url":"https://api.github.com/users/rob-parker-geo/following{/other_user}","gists_url":"https://api.github.com/users/rob-parker-geo/gists{/gist_id}","starred_url":"https://api.github.com/users/rob-parker-geo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rob-parker-geo/subscriptions","organizations_url":"https://api.github.com/users/rob-parker-geo/orgs","repos_url":"https://api.github.com/users/rob-parker-geo/repos","events_url":"https://api.github.com/users/rob-parker-geo/events{/privacy}","received_events_url":"https://api.github.com/users/rob-parker-geo/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2019-01-03T16:25:20Z","updated_at":"2019-01-03T16:25:20Z","closed_at":null,"author_association":"NONE","body":"<!--- Verify first that your issue is not already reported on GitHub -->\r\n<!--- Also test if the latest release and devel branch are affected too -->\r\n<!--- Complete *all* sections as described, this form is processed automatically -->\r\n\r\n##### SUMMARY\r\nThe `redhat_subscription` module ignores the `consumer_name` parameter if the `activationkey` parameter is specified.\r\n\r\n##### ISSUE TYPE\r\n- Bug Report\r\n\r\n##### COMPONENT NAME\r\n`redhat_subscription` module\r\n\r\n##### ANSIBLE VERSION\r\n<!--- Paste verbatim output from \"ansible --version\" between quotes -->\r\n```paste below\r\nansible 2.2.1.0\r\n  config file = /etc/ansible/ansible.cfg\r\n  configured module search path = Default w/o overrides\r\n```\r\n\r\nNB: I have also viewed (but not run) the [current source code](https://github.com/ansible/ansible/blob/devel/lib/ansible/modules/packaging/os/redhat_subscription.py#L360) for this module, and this appears unchanged from the behaviour I'm seeing in Ansible 2.2.x, in so far as it only appears to use `consumer_name` when `activationkey` is unset.\r\n\r\n##### CONFIGURATION\r\n<!--- Paste verbatim output from \"ansible-config dump --only-changed\" between quotes -->\r\n_Ansible 2.2.x is too old to provide the `ansible-config` command._\r\n\r\n##### OS / ENVIRONMENT\r\n<!--- Provide all relevant information below, e.g. target OS versions, network device firmware, etc. -->\r\n**Ansible host OS:** Debian 9\r\n**Target OS:** RHEL 7\r\n\r\n##### STEPS TO REPRODUCE\r\n<!--- Describe exactly how to reproduce the problem, using a minimal test-case -->\r\n\r\n<!--- Paste example playbooks or commands between quotes below -->\r\n```yaml\r\n- name: Example server config (rhel7)\r\n  hosts: an-example-rhel7-server\r\n  tasks:\r\n\r\n    - name: Register system with Red Hat Subscription Management\r\n      redhat_subscription:\r\n        org_id: \"{{ common_redhat_subscription_org_id }}\"\r\n        activationkey: \"{{ common_redhat_subscription_activationkey }}\"\r\n        consumer_name: \"{{ common_redhat_subscription_consumer_name }}\"\r\n        state: present\r\n\r\n  become: yes\r\n  become_method: sudo\r\n  vars:\r\n    ansible_ssh_pipelining: yes\r\n```\r\n\r\n<!--- HINT: You can paste gist.github.com links for larger files -->\r\n\r\n##### EXPECTED RESULTS\r\n<!--- Describe what you expected to happen when running the steps above -->\r\nThe system should be registered with specified `consumer_name` parameter's value, equivalent to passing the `--name=SYSTEM_NAME` option to a `subscription-manager register` command.\r\n\r\nAfter which running `subscription-manager identity` should return the correct `consumer_name` on the `system identity` line.\r\n\r\n##### ACTUAL RESULTS\r\n<!--- Describe what actually happened. If possible run with extra verbosity (-vvvv) -->\r\n\r\n<!--- Paste verbatim command output between quotes -->\r\n```paste below\r\nUsing /etc/ansible/ansible.cfg as config file\r\n\r\nPLAYBOOK: rhel7-example-servers.yml ********************************************\r\n1 plays in rhel7-example-servers.yml\r\n\r\nPLAY [Example server config (rhel7)] *******************************************\r\n\r\nTASK [setup] *******************************************************************\r\nUsing module file /usr/lib/python2.7/dist-packages/ansible/modules/core/system/setup.py\r\n<an-example-rhel7-server> ESTABLISH SSH CONNECTION FOR USER: redacted_user\r\n<an-example-rhel7-server> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o 'IdentityFile=\"/path/to/id_rsa\"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=redacted_user -o ConnectTimeout=10 -o ControlPath=/path/to/.ansible/cp/%C an-example-rhel7-server '/bin/sh -c '\"'\"'sudo -H -S -n -u root /bin/sh -c '\"'\"'\"'\"'\"'\"'\"'\"'echo BECOME-SUCCESS-redacted; /usr/bin/python'\"'\"'\"'\"'\"'\"'\"'\"' && sleep 0'\"'\"''\r\nok: [an-example-rhel7-server]\r\n\r\nTASK [rhel7-common : Register system with Red Hat Subscription Management] *****\r\ntask path: /path/to/rhel7-example-servers.yml:5\r\nUsing module file /usr/lib/python2.7/dist-packages/ansible/modules/core/packaging/os/redhat_subscription.py\r\n<an-example-rhel7-server> ESTABLISH SSH CONNECTION FOR USER: redacted_user\r\n<an-example-rhel7-server> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o 'IdentityFile=\"/path/to/id_rsa\"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=redacted_user -o ConnectTimeout=10 -o ControlPath=/path/to/.ansible/cp/%C an-example-rhel7-server '/bin/sh -c '\"'\"'sudo -H -S -n -u root /bin/sh -c '\"'\"'\"'\"'\"'\"'\"'\"'echo BECOME-SUCCESS-redacted; /usr/bin/python'\"'\"'\"'\"'\"'\"'\"'\"' && sleep 0'\"'\"''\r\nchanged: [an-example-rhel7-server] => {\r\n    \"changed\": true, \r\n    \"invocation\": {\r\n        \"module_args\": {\r\n            \"activationkey\": \"redacted_activation_key\", \r\n            \"autosubscribe\": false, \r\n            \"consumer_id\": null, \r\n            \"consumer_name\": \"a_redacted_consumer_name_which_differs_from_hostname\", \r\n            \"consumer_type\": null, \r\n            \"environment\": null, \r\n            \"force_register\": false, \r\n            \"org_id\": \"redacted_numeric_org_id\", \r\n            \"password\": null, \r\n            \"pool\": \"^$\", \r\n            \"rhsm_baseurl\": \"https://cdn.redhat.com\", \r\n            \"server_hostname\": \"subscription.rhsm.redhat.com\", \r\n            \"server_insecure\": \"0\", \r\n            \"state\": \"present\", \r\n            \"username\": null\r\n        }, \r\n        \"module_name\": \"redhat_subscription\"\r\n    }, \r\n    \"msg\": \"System successfully registered to 'subscription.rhsm.redhat.com'.\", \r\n    \"subscribed_pool_ids\": []\r\n}\r\n\r\nPLAY RECAP *********************************************************************\r\nan-example-rhel7-server : ok=13   changed=1    unreachable=0    failed=0   \r\n```\r\n\r\nNB: I have also viewed (but not run) the [current source code](https://github.com/ansible/ansible/blob/devel/lib/ansible/modules/packaging/os/redhat_subscription.py#L360) for this module, and this appears unchanged from the behaviour I'm seeing in Ansible 2.2.x, in so far as it only appears to use `consumer_name` when `activationkey` is unset.\r\n"}}
{"actor":{"display_login":"rob-parker-geo"}}