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

rhn_register: added force option to allow forced registering (#1454) (#1455)

* rhn_register: added force option to allow forced registering (#1454)

* rhn_register: added disable=bad-option-value to pylint disables for backwards compat

* rhn_register: including version_added for force parameter

Co-authored-by: Felix Fontein <felix@fontein.de>

* [1455] added changelog fragment

* removed unnecessary pylint disables

* Updated changelogs/fragments/1455-rhn-register-force.yml to have issue # instead of PR #

Co-authored-by: Amin Vakil <info@aminvakil.com>

Co-authored-by: Felix Fontein <felix@fontein.de>
Co-authored-by: Amin Vakil <info@aminvakil.com>
This commit is contained in:
Dr. Nick 2020-12-08 07:12:04 -05:00 committed by GitHub
parent 1d1d934bdd
commit 68dec29df3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 1 deletions

View file

@ -0,0 +1,2 @@
minor_changes:
- rhn_register - added ``force`` parameter to allow forced registering (https://github.com/ansible-collections/community.general/issues/1454).

View file

@ -49,6 +49,12 @@ options:
description: description:
- Supply an profilename for use with registration. - Supply an profilename for use with registration.
type: str type: str
force:
description:
- Force registration, even if system is already registered.
type: bool
default: no
version_added: 2.0.0
ca_cert: ca_cert:
description: description:
- Supply a custom ssl CA certificate file for use with registration. - Supply a custom ssl CA certificate file for use with registration.
@ -114,6 +120,14 @@ EXAMPLES = r'''
username: joe_user username: joe_user
password: somepass password: somepass
channels: rhel-x86_64-server-6-foo-1,rhel-x86_64-server-6-bar-1 channels: rhel-x86_64-server-6-foo-1,rhel-x86_64-server-6-bar-1
- name: Force-register as user with password to ensure registration is current on server
community.general.rhn_register:
state: present
username: joe_user
password: somepass
server_url: https://xmlrpc.my.satellite/XMLRPC
force: yes
''' '''
RETURN = r''' RETURN = r'''
@ -346,6 +360,7 @@ def main():
ca_cert=dict(type='path', aliases=['sslcacert']), ca_cert=dict(type='path', aliases=['sslcacert']),
systemorgid=dict(type='str'), systemorgid=dict(type='str'),
enable_eus=dict(type='bool', default=False), enable_eus=dict(type='bool', default=False),
force=dict(type='bool', default=False),
nopackages=dict(type='bool', default=False), nopackages=dict(type='bool', default=False),
channels=dict(type='list', elements='str', default=[]), channels=dict(type='list', elements='str', default=[]),
), ),
@ -365,6 +380,7 @@ def main():
password = module.params['password'] password = module.params['password']
state = module.params['state'] state = module.params['state']
force = module.params['force']
activationkey = module.params['activationkey'] activationkey = module.params['activationkey']
profilename = module.params['profilename'] profilename = module.params['profilename']
sslcacert = module.params['ca_cert'] sslcacert = module.params['ca_cert']
@ -395,7 +411,7 @@ def main():
module.fail_json(msg="Missing arguments, If registering without an activationkey, must supply username or password") module.fail_json(msg="Missing arguments, If registering without an activationkey, must supply username or password")
# Register system # Register system
if rhn.is_registered: if rhn.is_registered and not force:
module.exit_json(changed=False, msg="System already registered.") module.exit_json(changed=False, msg="System already registered.")
try: try: