�
�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 m Z m Z d d
l m Z d d l m Z d 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_bys�
---
module: a10_virtual_server
version_added: 1.8
short_description: Manage A10 Networks AX/SoftAX/Thunder/vThunder devices' virtual servers.
description:
- Manage SLB (Server Load Balancing) virtual server objects on A10 Networks devices via aXAPIv2.
author:
- Eric Chou (@ericchou1)
- Mischa Peters (@mischapeters)
notes:
- Requires A10 Networks aXAPI 2.1.
extends_documentation_fragment:
- a10
- url
options:
state:
description:
- If the specified virtual server should exist.
choices: ['present', 'absent']
default: present
partition:
version_added: "2.3"
description:
- set active-partition
virtual_server:
description:
- The SLB (Server Load Balancing) virtual server name.
required: true
aliases: ['vip', 'virtual']
virtual_server_ip:
description:
- The SLB virtual server IPv4 address.
aliases: ['ip', 'address']
virtual_server_status:
description:
- The SLB virtual server status, such as enabled or disabled.
default: enable
aliases: ['status']
choices: ['enabled', 'disabled']
virtual_server_ports:
description:
- A list of ports to create for the virtual server. Each list item should be a
dictionary which specifies the C(port:) and C(type:), but can also optionally
specify the C(service_group:) as well as the C(status:). See the examples
below for details. This parameter is required when C(state) is C(present).
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 virtual server
- a10_virtual_server:
host: a10.mydomain.com
username: myadmin
password: mypassword
partition: mypartition
virtual_server: vserver1
virtual_server_ip: 1.1.1.1
virtual_server_ports:
- port: 80
protocol: TCP
service_group: sg-80-tcp
- port: 443
protocol: HTTPS
service_group: sg-443-https
- port: 8080
protocol: http
status: disabled
s�
content:
description: the full info regarding the slb_virtual
returned: success
type: str
sample: "mynewvirtualserver"
N( t
axapi_callt a10_argument_spect axapi_authenticatet
axapi_failuret axapi_enabled_disabledt axapi_get_vport_protocolt AXAPI_VPORT_PROTOCOLS( t
AnsibleModule( t url_argument_spect portt protocolt
service_groupc C` se x^| D]V} x@ | D]8 } | t k r | j d d | d j t � f � q q Wd | k r� y t | d � | d <Wq� t k
r� | j d d � q� Xn | j d d � d | k r� t | d � } | s� | j d d d j t � � q| | d <n | j d d d j t � � d
| k r:t | d
� | d
<n
d | d
<d | k r d
| d <q q Wd S( Nt msgs+ invalid port field (%s), must be one of: %st ,R s! port definitions must be integerss+ port definitions must define the port fieldR s) invalid port protocol, must be one of: %ss3 port definitions must define the port protocol (%s)R i R t ( t VALID_PORT_FIELDSt fail_jsont joint intt ExceptionR
R R ( t modulet portst itemt keyR ( ( sR /usr/lib/python2.7/site-packages/ansible/modules/network/a10/a10_virtual_server.pyt validate_portsr 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 g d t � d
t d d d d d g d t � d t d d d d d d g d d d g � d t d d d t � d t d d d g � � � t d | d t � } | j d } | j d } | j d } | j d } | j d } | j d } | j d } | j d
} | j d }
| j d } | d k r�| j d d � n t
| | � d | } t | | | | � }
t | |
d t
j i | d! 6� � t | |
d"