Adds description parameter to pools (#19362)

This patch adds the description parameter as a supported param of
the bigip_pool module.

Tests for this change are available here

https://github.com/F5Networks/f5-ansible/blob/master/roles/bigip_pool/tasks/main.yaml#L732
pull/19411/head
Tim Rupp 8 years ago committed by Peter Sprygada
parent 7900319fc3
commit e0e1d3b561

@ -39,6 +39,11 @@ notes:
requirements:
- bigsuds
options:
description:
description:
- Specifies descriptive text that identifies the pool.
required: false
version_added: "2.3"
state:
description:
- Pool/pool member state
@ -347,6 +352,16 @@ def add_pool_member(api, pool, address, port):
api.LocalLB.Pool.add_member_v2(pool_names=[pool], members=[members])
def set_description(api, pool, description):
api.LocalLB.Pool.set_description(
pool_names=[pool], descriptions=[description]
)
def get_description(api, pool):
return api.LocalLB.Pool.get_description(pool_names=[pool])[0]
def main():
lb_method_choices = ['round_robin', 'ratio_member',
'least_connection_member', 'observed_member',
@ -377,7 +392,8 @@ def main():
reselect_tries=dict(type='int'),
service_down_action=dict(type='str', choices=service_down_choices),
host=dict(type='str', aliases=['address']),
port=dict(type='int')
port=dict(type='int'),
description=dict(type='str')
)
argument_spec.update(meta_args)
@ -401,6 +417,7 @@ def main():
state = module.params['state']
partition = module.params['partition']
validate_certs = module.params['validate_certs']
description = module.params['description']
name = module.params['name']
pool = fq_name(partition, name)
@ -415,7 +432,7 @@ def main():
if monitors:
monitors = []
for monitor in module.params['monitors']:
monitors.append(fq_name(partition, monitor))
monitors.append(fq_name(partition, monitor))
slow_ramp_time = module.params['slow_ramp_time']
reselect_tries = module.params['reselect_tries']
service_down_action = module.params['service_down_action']
@ -514,6 +531,8 @@ def main():
set_action_on_service_down(api, pool, service_down_action)
if host and port:
add_pool_member(api, pool, address, port)
if description:
set_description(api, pool, description)
else:
# check-mode return value
result = {'changed': True}
@ -552,6 +571,10 @@ def main():
if not module.check_mode:
add_pool_member(api, pool, address, port)
result = {'changed': True}
if description and description != get_description(api, pool):
if not module.check_mode:
set_description(api, pool, description)
result = {'changed': True}
except Exception as e:
module.fail_json(msg="received exception: %s" % e)

Loading…
Cancel
Save