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

Added nopackages option and Fix #24997 (#28831)

* Added nopackages option and Fix #24997
Adding a new option - nopackages.
This enables the option to add the --nopackages flag while registering a new node to RHN Satellite. We are not uploading the rpm data on our nodes and since we started utilizing ansible for nodes registration, I figures it would be useful for others as well.
Also-
Fixes #24997 (verified in my lab)

* Fixed documentation

* Documentation changes:
- typo fix in "default"
- Added "version_added" and set to 2.4

* Documentation changes:
- Removed trailing whitespaces in nopackages['version_added']

* This change is unrelated for this feature pull request and shouldn't be here (and also seems wrong, see #25079).

* Changed "version_added" to 2.5 in the module docs
This commit is contained in:
Moshe Shitrit 2017-09-15 10:50:47 -04:00 committed by ansibot
parent 9af6dc4751
commit 7da69a23e6

View file

@ -81,6 +81,12 @@ options:
- If true, extended update support will be requested.
required: false
default: false
nopackages:
description:
- If true, the registered node will not upload its installed packages information to Satellite server
required: false
default: false
version_added: "2.5"
'''
EXAMPLES = '''
@ -250,7 +256,7 @@ class Rhn(redhat.RegistrationBase):
self.update_plugin_conf('rhnplugin', True)
self.update_plugin_conf('subscription-manager', False)
def register(self, enable_eus=False, activationkey=None, profilename=None, sslcacert=None, systemorgid=None):
def register(self, enable_eus=False, activationkey=None, profilename=None, sslcacert=None, systemorgid=None, nopackages=False):
'''
Register system to RHN. If enable_eus=True, extended update
support will be requested.
@ -262,6 +268,8 @@ class Rhn(redhat.RegistrationBase):
register_cmd.extend(['--serverUrl', self.server_url])
if enable_eus:
register_cmd.append('--use-eus-channel')
if nopackages:
register_cmd.append('--nopackages')
if activationkey is not None:
register_cmd.extend(['--activationkey', activationkey])
if profilename is not None:
@ -346,6 +354,7 @@ def main():
sslcacert=dict(default=None, required=False, type='path'),
systemorgid=dict(default=None, required=False),
enable_eus=dict(default=False, type='bool'),
nopackages=dict(default=False, type='bool'),
channels=dict(default=[], type='list'),
)
)
@ -364,6 +373,7 @@ def main():
systemorgid = module.params['systemorgid']
channels = module.params['channels']
enable_eus = module.params['enable_eus']
nopackages = module.params['nopackages']
rhn = Rhn(module=module, username=username, password=password)
@ -392,7 +402,7 @@ def main():
try:
rhn.enable()
rhn.register(enable_eus, activationkey, profilename, sslcacert, systemorgid)
rhn.register(enable_eus, activationkey, profilename, sslcacert, systemorgid, nopackages)
rhn.subscribe(channels)
except Exception as exc:
module.fail_json(msg="Failed to register with '%s': %s" % (rhn.hostname, exc))