Merge pull request #4941 from sivel/rax-clb-shared-vip

Add ability to specify a VirtualIP ID for sharing a VIP with another LB
pull/5828/head
jctanner 11 years ago
commit 6265128c9e

@ -74,6 +74,11 @@ options:
username: username:
description: description:
- Rackspace username (overrides C(credentials)) - Rackspace username (overrides C(credentials))
vip_id:
description:
- Virtual IP ID to use when creating the load balancer for purposes of
sharing an IP with another load balancer of another protocol
version_added: 1.5
wait: wait:
description: description:
- wait for the balancer to be in state 'running' before returning - wait for the balancer to be in state 'running' before returning
@ -165,7 +170,7 @@ def to_dict(obj):
def cloud_load_balancer(module, state, name, meta, algorithm, port, protocol, def cloud_load_balancer(module, state, name, meta, algorithm, port, protocol,
vip_type, timeout, wait, wait_timeout): vip_type, timeout, wait, wait_timeout, vip_id):
for arg in (state, name, port, protocol, vip_type): for arg in (state, name, port, protocol, vip_type):
if not arg: if not arg:
module.fail_json(msg='%s is required for rax_clb' % arg) module.fail_json(msg='%s is required for rax_clb' % arg)
@ -194,7 +199,7 @@ def cloud_load_balancer(module, state, name, meta, algorithm, port, protocol,
if not balancers: if not balancers:
try: try:
virtual_ips = [clb.VirtualIP(type=vip_type)] virtual_ips = [clb.VirtualIP(type=vip_type, id=vip_id)]
balancer = clb.create(name, metadata=metadata, port=port, balancer = clb.create(name, metadata=metadata, port=port,
algorithm=algorithm, protocol=protocol, algorithm=algorithm, protocol=protocol,
timeout=timeout, virtual_ips=virtual_ips) timeout=timeout, virtual_ips=virtual_ips)
@ -284,6 +289,7 @@ def main():
state=dict(default='present', choices=['present', 'absent']), state=dict(default='present', choices=['present', 'absent']),
timeout=dict(type='int', default=30), timeout=dict(type='int', default=30),
type=dict(choices=['PUBLIC', 'SERVICENET'], default='PUBLIC'), type=dict(choices=['PUBLIC', 'SERVICENET'], default='PUBLIC'),
vip_id=dict(),
wait=dict(type='bool'), wait=dict(type='bool'),
wait_timeout=dict(default=300), wait_timeout=dict(default=300),
) )
@ -301,6 +307,7 @@ def main():
protocol = module.params.get('protocol') protocol = module.params.get('protocol')
state = module.params.get('state') state = module.params.get('state')
timeout = int(module.params.get('timeout')) timeout = int(module.params.get('timeout'))
vip_id = module.params.get('vip_id')
vip_type = module.params.get('type') vip_type = module.params.get('type')
wait = module.params.get('wait') wait = module.params.get('wait')
wait_timeout = int(module.params.get('wait_timeout')) wait_timeout = int(module.params.get('wait_timeout'))
@ -308,7 +315,7 @@ def main():
setup_rax_module(module, pyrax) setup_rax_module(module, pyrax)
cloud_load_balancer(module, state, name, meta, algorithm, port, protocol, cloud_load_balancer(module, state, name, meta, algorithm, port, protocol,
vip_type, timeout, wait, wait_timeout) vip_type, timeout, wait, wait_timeout, vip_id)
# import module snippets # import module snippets

Loading…
Cancel
Save