rhn_register: add support for profilename

This commit is contained in:
Sebastian Gerhards 2014-12-02 11:33:10 +01:00
parent 9de0045d00
commit cda40bc33c

View file

@ -56,6 +56,11 @@ options:
- supply an activation key for use with registration - supply an activation key for use with registration
required: False required: False
default: null default: null
profilename:
description:
- supply an profilename for use with registration
required: False
default: null
channels: channels:
description: description:
- Optionally specify a list of comma-separated channels to subscribe to upon successful registration. - Optionally specify a list of comma-separated channels to subscribe to upon successful registration.
@ -73,6 +78,9 @@ EXAMPLES = '''
# Register with activationkey (1-222333444) and enable extended update support. # Register with activationkey (1-222333444) and enable extended update support.
- rhn_register: state=present activationkey=1-222333444 enable_eus=true - rhn_register: state=present activationkey=1-222333444 enable_eus=true
# Register with activationkey (1-222333444) and set a profilename which may differ from the hostname.
- rhn_register: state=present activationkey=1-222333444 profilename=host.example.com.custom
# Register as user (joe_user) with password (somepass) against a satellite # Register as user (joe_user) with password (somepass) against a satellite
# server specified by (server_url). # server specified by (server_url).
- rhn_register: > - rhn_register: >
@ -209,7 +217,7 @@ class Rhn(RegistrationBase):
self.update_plugin_conf('rhnplugin', True) self.update_plugin_conf('rhnplugin', True)
self.update_plugin_conf('subscription-manager', False) self.update_plugin_conf('subscription-manager', False)
def register(self, enable_eus=False, activationkey=None): def register(self, enable_eus=False, activationkey=None, profilename=None):
''' '''
Register system to RHN. If enable_eus=True, extended update Register system to RHN. If enable_eus=True, extended update
support will be requested. support will be requested.
@ -221,7 +229,8 @@ class Rhn(RegistrationBase):
register_cmd += " --use-eus-channel" register_cmd += " --use-eus-channel"
if activationkey is not None: if activationkey is not None:
register_cmd += " --activationkey '%s'" % activationkey register_cmd += " --activationkey '%s'" % activationkey
# FIXME - support --profilename if profilename is not None:
register_cmd += " --profilename '%s'" % profilename
# FIXME - support --systemorgid # FIXME - support --systemorgid
rc, stdout, stderr = self.module.run_command(register_cmd, check_rc=True, use_unsafe_shell=True) rc, stdout, stderr = self.module.run_command(register_cmd, check_rc=True, use_unsafe_shell=True)
@ -285,6 +294,7 @@ def main():
password = dict(default=None, required=False), password = dict(default=None, required=False),
server_url = dict(default=rhn.config.get_option('serverURL'), required=False), server_url = dict(default=rhn.config.get_option('serverURL'), required=False),
activationkey = dict(default=None, required=False), activationkey = dict(default=None, required=False),
profilename = dict(default=None, required=False),
enable_eus = dict(default=False, type='bool'), enable_eus = dict(default=False, type='bool'),
channels = dict(default=[], type='list'), channels = dict(default=[], type='list'),
) )
@ -295,6 +305,7 @@ def main():
rhn.password = module.params['password'] rhn.password = module.params['password']
rhn.configure(module.params['server_url']) rhn.configure(module.params['server_url'])
activationkey = module.params['activationkey'] activationkey = module.params['activationkey']
profilename = module.params['profilename']
channels = module.params['channels'] channels = module.params['channels']
rhn.module = module rhn.module = module