�
�Udac @` s� d d l m Z m Z m Z e Z i d d 6d g d 6d d 6Z d Z d Z d
Z d d l
Z
d d l m Z m
Z
m Z m Z m Z d d
l m Z d d l m Z d d d g Z d d d g Z d � Z d � Z e d k r� e � n d S( i ( t absolute_importt divisiont print_functions 1.1t metadata_versiont previewt statust communityt supported_bysP
---
module: a10_service_group
version_added: 1.8
short_description: Manage A10 Networks AX/SoftAX/Thunder/vThunder devices' service groups.
description:
- Manage SLB (Server Load Balancing) service-group objects on A10 Networks devices via aXAPIv2.
author:
- Eric Chou (@ericchou1)
- Mischa Peters (@mischapeters)
notes:
- Requires A10 Networks aXAPI 2.1.
- When a server doesn't exist and is added to the service-group the server will be created.
extends_documentation_fragment:
- a10
- url
options:
state:
description:
- If the specified service group should exists.
default: present
choices: ['present', 'absent']
partition:
version_added: "2.3"
description:
- set active-partition
service_group:
description:
- The SLB (Server Load Balancing) service-group name
required: true
aliases: ['service', 'pool', 'group']
service_group_protocol:
description:
- The SLB service-group protocol of TCP or UDP.
default: tcp
aliases: ['proto', 'protocol']
choices: ['tcp', 'udp']
service_group_method:
description:
- The SLB service-group load balancing method, such as round-robin or weighted-rr.
default: round-robin
aliases: ['method']
choices:
- 'round-robin'
- 'weighted-rr'
- 'least-connection'
- 'weighted-least-connection'
- 'service-least-connection'
- 'service-weighted-least-connection'
- 'fastest-response'
- 'least-request'
- 'round-robin-strict'
- 'src-ip-only-hash'
- 'src-ip-hash'
servers:
description:
- A list of servers to add to the service group. Each list item should be a
dictionary which specifies the C(server:) and C(port:), but can also optionally
specify the C(status:). See the examples below for details.
aliases: ['server', 'member']
validate_certs:
description:
- If C(no), SSL certificates will not be validated. This should only be used
on personally controlled devices using self-signed certificates.
type: bool
default: 'yes'
s�
# Create a new service-group
- a10_service_group:
host: a10.mydomain.com
username: myadmin
password: mypassword
partition: mypartition
service_group: sg-80-tcp
servers:
- server: foo1.mydomain.com
port: 8080
- server: foo2.mydomain.com
port: 8080
- server: foo3.mydomain.com
port: 8080
- server: foo4.mydomain.com
port: 8080
status: disabled
s�
content:
description: the full info regarding the slb_service_group
returned: success
type: str
sample: "mynewservicegroup"
N( t
axapi_callt a10_argument_spect axapi_authenticatet
axapi_failuret axapi_enabled_disabled( t
AnsibleModule( t url_argument_spect namet protocolt lb_methodt servert portc C` s� x� | D]� } x@ | D]8 } | t k r | j d d | d j t � f � q q Wd | k ro | j d d � n d | k r� y t | d � | d <Wq� t k
r� | j d d � q� Xn | j d d � d | k r� t | d � | d <q d
| d <q Wd S( Nt msgs- invalid server field (%s), must be one of: %st ,R s/ server definitions must define the server fieldR s( server port definitions must be integerss- server definitions must define the port fieldR i ( t VALID_SERVER_FIELDSt fail_jsont joint intt ExceptionR ( t modulet serverst itemt key( ( sQ /usr/lib/python2.7/site-packages/ansible/modules/network/a10/a10_service_group.pyt validate_servers~ s
*
c ! C` s t � } | j t � � | j t d t d d d d d d d g � d t d d d d
d d g d
t � d t d d d d d d d g d d d g � d t d d d d d d g d d d d d d d d d d d d g � d t d d! d d"