@ -34,6 +34,12 @@ notes:
- Requires A10 Networks aXAPI 2.1 .
- Requires A10 Networks aXAPI 2.1 .
extends_documentation_fragment : a10
extends_documentation_fragment : a10
options :
options :
partition :
version_added : " 2.3 "
description :
- set active - partition
required : false
default : null
virtual_server :
virtual_server :
description :
description :
- The SLB ( Server Load Balancing ) virtual server name .
- The SLB ( Server Load Balancing ) virtual server name .
@ -80,6 +86,7 @@ EXAMPLES = '''
host : a10 . mydomain . com
host : a10 . mydomain . com
username : myadmin
username : myadmin
password : mypassword
password : mypassword
partition : mypartition
virtual_server : vserver1
virtual_server : vserver1
virtual_server_ip : 1.1 .1 .1
virtual_server_ip : 1.1 .1 .1
virtual_server_ports :
virtual_server_ports :
@ -95,6 +102,14 @@ EXAMPLES = '''
'''
'''
RETURN = '''
content :
description : the full info regarding the slb_virtual
returned : success
type : string
sample : " mynewvirtualserver "
'''
VALID_PORT_FIELDS = [ ' port ' , ' protocol ' , ' service_group ' , ' status ' ]
VALID_PORT_FIELDS = [ ' port ' , ' protocol ' , ' service_group ' , ' status ' ]
def validate_ports ( module , ports ) :
def validate_ports ( module , ports ) :
@ -143,6 +158,7 @@ def main():
virtual_server_ip = dict ( type = ' str ' , aliases = [ ' ip ' , ' address ' ] , required = True ) ,
virtual_server_ip = dict ( type = ' str ' , aliases = [ ' ip ' , ' address ' ] , required = True ) ,
virtual_server_status = dict ( type = ' str ' , default = ' enabled ' , aliases = [ ' status ' ] , choices = [ ' enabled ' , ' disabled ' ] ) ,
virtual_server_status = dict ( type = ' str ' , default = ' enabled ' , aliases = [ ' status ' ] , choices = [ ' enabled ' , ' disabled ' ] ) ,
virtual_server_ports = dict ( type = ' list ' , required = True ) ,
virtual_server_ports = dict ( type = ' list ' , required = True ) ,
partition = dict ( type = ' str ' , default = [ ] ) ,
)
)
)
)
@ -154,6 +170,7 @@ def main():
host = module . params [ ' host ' ]
host = module . params [ ' host ' ]
username = module . params [ ' username ' ]
username = module . params [ ' username ' ]
password = module . params [ ' password ' ]
password = module . params [ ' password ' ]
partition = module . params [ ' partition ' ]
state = module . params [ ' state ' ]
state = module . params [ ' state ' ]
write_config = module . params [ ' write_config ' ]
write_config = module . params [ ' write_config ' ]
slb_virtual = module . params [ ' virtual_server ' ]
slb_virtual = module . params [ ' virtual_server ' ]
@ -169,6 +186,7 @@ def main():
axapi_base_url = ' https:// %s /services/rest/V2.1/?format=json ' % host
axapi_base_url = ' https:// %s /services/rest/V2.1/?format=json ' % host
session_url = axapi_authenticate ( module , axapi_base_url , username , password )
session_url = axapi_authenticate ( module , axapi_base_url , username , password )
slb_server_partition = axapi_call ( module , session_url + ' &method=system.partition.active ' , json . dumps ( { ' name ' : partition } ) )
slb_virtual_data = axapi_call ( module , session_url + ' &method=slb.virtual_server.search ' , json . dumps ( { ' name ' : slb_virtual } ) )
slb_virtual_data = axapi_call ( module , session_url + ' &method=slb.virtual_server.search ' , json . dumps ( { ' name ' : slb_virtual } ) )
slb_virtual_exists = not axapi_failure ( slb_virtual_data )
slb_virtual_exists = not axapi_failure ( slb_virtual_data )