Made user and password options that can be passed to the module
This commit is contained in:
parent
38c41b6f9e
commit
98406462d1
1 changed files with 15 additions and 4 deletions
|
@ -31,9 +31,18 @@ options:
|
||||||
description:
|
description:
|
||||||
- The full url to the rhn/sattelite api
|
- The full url to the rhn/sattelite api
|
||||||
required: true
|
required: true
|
||||||
|
default: https://rhn.redhat.com/rpc/api
|
||||||
|
user:
|
||||||
|
description:
|
||||||
|
- the user to login to rhn/sattelite
|
||||||
|
required: true
|
||||||
|
pwd:
|
||||||
|
description:
|
||||||
|
- the user's password
|
||||||
|
required: true
|
||||||
examples:
|
examples:
|
||||||
- code: rhn_channel name=rhel-x86_64-server-v2vwin-6 sysname=server01
|
- code: rhn_channel name=rhel-x86_64-server-v2vwin-6 sysname=server01
|
||||||
url=https://rhn.redhat.com/rpc/api
|
url=https://rhn.redhat.com/rpc/api user=rhnuser pwd=guessme
|
||||||
description: add software channel rhel-x86_64-server-v2vwin-6
|
description: add software channel rhel-x86_64-server-v2vwin-6
|
||||||
to server01 in Red Hat Network
|
to server01 in Red Hat Network
|
||||||
'''
|
'''
|
||||||
|
@ -93,6 +102,8 @@ def main():
|
||||||
name = dict(required=True),
|
name = dict(required=True),
|
||||||
sysname = dict(required=True),
|
sysname = dict(required=True),
|
||||||
url = dict(required=True),
|
url = dict(required=True),
|
||||||
|
user = dict(required=True),
|
||||||
|
pwd = dict(required=True),
|
||||||
)
|
)
|
||||||
# supports_check_mode=True
|
# supports_check_mode=True
|
||||||
)
|
)
|
||||||
|
@ -101,10 +112,10 @@ def main():
|
||||||
channelname = module.params['name']
|
channelname = module.params['name']
|
||||||
systname = module.params['sysname']
|
systname = module.params['sysname']
|
||||||
saturl = module.params['url']
|
saturl = module.params['url']
|
||||||
|
user = module.params['user']
|
||||||
|
pwd = module.params['pwd']
|
||||||
|
|
||||||
#initialize connection
|
#initialize connection
|
||||||
user = ""
|
|
||||||
pwd = ""
|
|
||||||
client = xmlrpclib.Server(saturl, verbose=0)
|
client = xmlrpclib.Server(saturl, verbose=0)
|
||||||
session = client.auth.login(user, pwd)
|
session = client.auth.login(user, pwd)
|
||||||
|
|
||||||
|
@ -125,7 +136,7 @@ def main():
|
||||||
|
|
||||||
if state == 'absent':
|
if state == 'absent':
|
||||||
if not channelname in chans:
|
if not channelname in chans:
|
||||||
module.exit_json(changed=False, msg="System not subscribed to channel %s." % channelname)
|
module.exit_json(changed=False, msg="Not subscribed to channel %s." % channelname)
|
||||||
else:
|
else:
|
||||||
unsubscribe_channels(channelname, client, session, systname, sys_id)
|
unsubscribe_channels(channelname, client, session, systname, sys_id)
|
||||||
module.exit_json(changed=True, msg="Channel %s removed" % channelname)
|
module.exit_json(changed=True, msg="Channel %s removed" % channelname)
|
||||||
|
|
Loading…
Reference in a new issue