diff --git a/changelogs/fragments/5627-redhat_subscription-subscribe-parameters-2.yaml b/changelogs/fragments/5627-redhat_subscription-subscribe-parameters-2.yaml new file mode 100644 index 0000000000..c76f6871d8 --- /dev/null +++ b/changelogs/fragments/5627-redhat_subscription-subscribe-parameters-2.yaml @@ -0,0 +1,3 @@ +bugfixes: + - redhat_subscription - do not ignore ``consumer_name`` and other variables if ``activationkey`` is specified + (https://github.com/ansible-collections/community.general/issues/3486, https://github.com/ansible-collections/community.general/pull/5627). diff --git a/plugins/modules/redhat_subscription.py b/plugins/modules/redhat_subscription.py index bb21578fa5..041c1a0097 100644 --- a/plugins/modules/redhat_subscription.py +++ b/plugins/modules/redhat_subscription.py @@ -411,23 +411,28 @@ class Rhsm(RegistrationBase): if org_id: args.extend(['--org', org_id]) + if auto_attach: + args.append('--auto-attach') + + if consumer_type: + args.extend(['--type', consumer_type]) + + if consumer_name: + args.extend(['--name', consumer_name]) + + if consumer_id: + args.extend(['--consumerid', consumer_id]) + + if environment: + args.extend(['--environment', environment]) + if activationkey: args.extend(['--activationkey', activationkey]) else: - if auto_attach: - args.append('--auto-attach') if username: args.extend(['--username', username]) if password: args.extend(['--password', password]) - if consumer_type: - args.extend(['--type', consumer_type]) - if consumer_name: - args.extend(['--name', consumer_name]) - if consumer_id: - args.extend(['--consumerid', consumer_id]) - if environment: - args.extend(['--environment', environment]) if release: args.extend(['--release', release])