Adds aliases parameter to gtm wide ip (#44652)

This parameter can assign aliases to a wide ip.
pull/44665/head
Tim Rupp 6 years ago committed by GitHub
parent 73c97cb779
commit f3a61dd93d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -92,11 +92,18 @@ options:
- The system uses this number with the Ratio load balancing method. - The system uses this number with the Ratio load balancing method.
version_added: 2.5 version_added: 2.5
irules: irules:
version_added: 2.6
description: description:
- List of rules to be applied. - List of rules to be applied.
- If you want to remove all existing iRules, specify a single empty value; C(""). - If you want to remove all existing iRules, specify a single empty value; C("").
See the documentation for an example. See the documentation for an example.
version_added: 2.6
aliases:
description:
- Specifies alternate domain names for the web site content you are load
balancing.
- You can use the same wildcard characters for aliases as you can for actual
wide IP names.
version_added: 2.7
extends_documentation_fragment: f5 extends_documentation_fragment: f5
author: author:
- Tim Rupp (@caphrim007) - Tim Rupp (@caphrim007)
@ -174,6 +181,11 @@ irules:
returned: changed returned: changed
type: list type: list
sample: ['/Common/irule1', '/Common/irule2'] sample: ['/Common/irule1', '/Common/irule2']
aliases:
description: Aliases set on the Wide IP.
returned: changed
type: list
sample: ['alias1.foo.com', '*.wildcard.domain']
''' '''
from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.basic import AnsibleModule
@ -217,15 +229,31 @@ class Parameters(AnsibleF5Parameters):
} }
updatables = [ updatables = [
'pool_lb_method', 'state', 'pools', 'irules', 'enabled', 'disabled' 'pool_lb_method',
'state',
'pools',
'irules',
'enabled',
'disabled',
'aliases',
] ]
returnables = [ returnables = [
'name', 'pool_lb_method', 'state', 'pools', 'irules' 'name',
'pool_lb_method',
'state',
'pools',
'irules',
'aliases',
] ]
api_attributes = [ api_attributes = [
'poolLbMode', 'enabled', 'disabled', 'pools', 'rules' 'poolLbMode',
'enabled',
'disabled',
'pools',
'rules',
'aliases',
] ]
@ -358,6 +386,15 @@ class ModuleParameters(Parameters):
results.append(result) results.append(result)
return results return results
@property
def aliases(self):
if self._values['aliases'] is None:
return None
if len(self._values['aliases']) == 1 and self._values['aliases'][0] == '':
return ''
self._values['aliases'].sort()
return self._values['aliases']
class Changes(Parameters): class Changes(Parameters):
def to_return(self): def to_return(self):
@ -458,6 +495,19 @@ class Difference(object):
if sorted(set(self.want.irules)) != sorted(set(self.have.irules)): if sorted(set(self.want.irules)) != sorted(set(self.have.irules)):
return self.want.irules return self.want.irules
@property
def aliases(self):
if self.want.aliases is None:
return None
if self.want.aliases == '' and self.have.aliases is None:
return None
if self.want.aliases == '' and len(self.have.aliases) > 0:
return []
if self.have.aliases is None:
return self.want.aliases
if set(self.want.aliases) != set(self.have.aliases):
return self.want.aliases
class ModuleManager(object): class ModuleManager(object):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
@ -748,6 +798,9 @@ class ArgumentSpec(object):
irules=dict( irules=dict(
type='list', type='list',
), ),
aliases=dict(
type='list'
)
) )
self.argument_spec = {} self.argument_spec = {}
self.argument_spec.update(f5_argument_spec) self.argument_spec.update(f5_argument_spec)

Loading…
Cancel
Save