1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Add release argument for redhat_subscription (#47888)

This commit is contained in:
Jason Walsh 2018-11-09 17:19:06 -05:00 committed by Sam Doran
parent 55f5a707fe
commit 96cdc9ec06

View file

@ -127,6 +127,10 @@ options:
type: bool
default: 'no'
version_added: "2.2"
release:
description:
- Set a release version
version_added: "2.8"
'''
EXAMPLES = '''
@ -190,6 +194,13 @@ EXAMPLES = '''
password: somepass
environment: Library
auto_attach: true
- name: Register as user (joe_user) with password (somepass) and a specific release
redhat_subscription:
state: present
username: joe_user
password: somepass
release: 7.4
'''
RETURN = '''
@ -313,7 +324,7 @@ class Rhsm(RegistrationBase):
def register(self, username, password, auto_attach, activationkey, org_id,
consumer_type, consumer_name, consumer_id, force_register, environment,
rhsm_baseurl, server_insecure, server_hostname, server_proxy_hostname,
server_proxy_port, server_proxy_user, server_proxy_password):
server_proxy_port, server_proxy_user, server_proxy_password, release):
'''
Register the current system to the provided RHSM or Sat6 server
Raises:
@ -361,6 +372,9 @@ class Rhsm(RegistrationBase):
if server_proxy_password:
args.extend(['--proxypassword', server_proxy_password])
if release:
args.extend(['--release', release])
rc, stderr, stdout = self.module.run_command(args, check_rc=True)
def unsubscribe(self, serials=None):
@ -657,6 +671,7 @@ def main():
server_proxy_password=dict(default=None,
required=False,
no_log=True),
release=dict(default=None, required=False)
),
required_together=[['username', 'password'],
['server_proxy_hostname', 'server_proxy_port'],
@ -704,6 +719,7 @@ def main():
server_proxy_port = module.params['server_proxy_port']
server_proxy_user = module.params['server_proxy_user']
server_proxy_password = module.params['server_proxy_password']
release = module.params['release']
global SUBMAN_CMD
SUBMAN_CMD = module.get_bin_path('subscription-manager', True)
@ -732,7 +748,7 @@ def main():
rhsm.register(username, password, auto_attach, activationkey, org_id,
consumer_type, consumer_name, consumer_id, force_register,
environment, rhsm_baseurl, server_insecure, server_hostname,
server_proxy_hostname, server_proxy_port, server_proxy_user, server_proxy_password)
server_proxy_hostname, server_proxy_port, server_proxy_user, server_proxy_password, release)
if pool_ids:
subscribed_pool_ids = rhsm.subscribe_by_pool_ids(pool_ids)
else: