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) * 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:
parent
1d1d934bdd
commit
68dec29df3
2 changed files with 19 additions and 1 deletions
2
changelogs/fragments/1455-rhn-register-force.yml
Normal file
2
changelogs/fragments/1455-rhn-register-force.yml
Normal 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).
|
|
@ -49,6 +49,12 @@ options:
|
|||
description:
|
||||
- Supply an profilename for use with registration.
|
||||
type: str
|
||||
force:
|
||||
description:
|
||||
- Force registration, even if system is already registered.
|
||||
type: bool
|
||||
default: no
|
||||
version_added: 2.0.0
|
||||
ca_cert:
|
||||
description:
|
||||
- Supply a custom ssl CA certificate file for use with registration.
|
||||
|
@ -114,6 +120,14 @@ EXAMPLES = r'''
|
|||
username: joe_user
|
||||
password: somepass
|
||||
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'''
|
||||
|
@ -346,6 +360,7 @@ def main():
|
|||
ca_cert=dict(type='path', aliases=['sslcacert']),
|
||||
systemorgid=dict(type='str'),
|
||||
enable_eus=dict(type='bool', default=False),
|
||||
force=dict(type='bool', default=False),
|
||||
nopackages=dict(type='bool', default=False),
|
||||
channels=dict(type='list', elements='str', default=[]),
|
||||
),
|
||||
|
@ -365,6 +380,7 @@ def main():
|
|||
password = module.params['password']
|
||||
|
||||
state = module.params['state']
|
||||
force = module.params['force']
|
||||
activationkey = module.params['activationkey']
|
||||
profilename = module.params['profilename']
|
||||
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")
|
||||
|
||||
# Register system
|
||||
if rhn.is_registered:
|
||||
if rhn.is_registered and not force:
|
||||
module.exit_json(changed=False, msg="System already registered.")
|
||||
|
||||
try:
|
||||
|
|
Loading…
Reference in a new issue