|
|
@ -33,13 +33,13 @@ options:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- the user to login to rhn/sattelite
|
|
|
|
- the user to login to rhn/sattelite
|
|
|
|
required: true
|
|
|
|
required: true
|
|
|
|
pwd:
|
|
|
|
password:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- the user's password
|
|
|
|
- the user's password
|
|
|
|
required: true
|
|
|
|
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 user=rhnuser pwd=guessme
|
|
|
|
url=https://rhn.redhat.com/rpc/api user=rhnuser password=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
|
|
|
|
'''
|
|
|
|
'''
|
|
|
@ -100,7 +100,7 @@ def main():
|
|
|
|
sysname = dict(required=True),
|
|
|
|
sysname = dict(required=True),
|
|
|
|
url = dict(required=True),
|
|
|
|
url = dict(required=True),
|
|
|
|
user = dict(required=True),
|
|
|
|
user = dict(required=True),
|
|
|
|
pwd = dict(required=True),
|
|
|
|
password = dict(required=True, aliases=['pwd']),
|
|
|
|
)
|
|
|
|
)
|
|
|
|
# supports_check_mode=True
|
|
|
|
# supports_check_mode=True
|
|
|
|
)
|
|
|
|
)
|
|
|
@ -110,11 +110,11 @@ def main():
|
|
|
|
systname = module.params['sysname']
|
|
|
|
systname = module.params['sysname']
|
|
|
|
saturl = module.params['url']
|
|
|
|
saturl = module.params['url']
|
|
|
|
user = module.params['user']
|
|
|
|
user = module.params['user']
|
|
|
|
pwd = module.params['pwd']
|
|
|
|
password = module.params['password']
|
|
|
|
|
|
|
|
|
|
|
|
#initialize connection
|
|
|
|
#initialize connection
|
|
|
|
client = xmlrpclib.Server(saturl, verbose=0)
|
|
|
|
client = xmlrpclib.Server(saturl, verbose=0)
|
|
|
|
session = client.auth.login(user, pwd)
|
|
|
|
session = client.auth.login(user, password)
|
|
|
|
|
|
|
|
|
|
|
|
# get systemid
|
|
|
|
# get systemid
|
|
|
|
sys_id = get_systemid(client, session, systname)
|
|
|
|
sys_id = get_systemid(client, session, systname)
|
|
|
@ -126,7 +126,6 @@ def main():
|
|
|
|
if state == 'present':
|
|
|
|
if state == 'present':
|
|
|
|
if channelname in chans:
|
|
|
|
if channelname in chans:
|
|
|
|
module.exit_json(changed=False, msg="Channel %s already exists" % channelname)
|
|
|
|
module.exit_json(changed=False, msg="Channel %s already exists" % channelname)
|
|
|
|
|
|
|
|
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
subscribe_channels(channelname, client, session, systname, sys_id)
|
|
|
|
subscribe_channels(channelname, client, session, systname, sys_id)
|
|
|
|
module.exit_json(changed=True, msg="Channel %s added" % channelname)
|
|
|
|
module.exit_json(changed=True, msg="Channel %s added" % channelname)
|
|
|
|