�
�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 y* d d l
m Z d d l m
Z
e Z Wn e k
r� Z e Z n Xd d
l m Z d d l m Z m Z m Z m Z m Z m Z d � Z d � Z d � Z d � Z d � Z e! d k re � n d S( i ( t absolute_importt divisiont print_functions 1.1t metadata_versiont previewt statust communityt supported_bys
---
module: netscaler_server
short_description: Manage server configuration
description:
- Manage server entities configuration.
- This module is intended to run either on the ansible control node or a bastion (jumpserver) with access to the actual netscaler instance.
version_added: "2.4.0"
author: George Nikolopoulos (@giorgos-nikolopoulos)
options:
name:
description:
- "Name for the server."
- >-
Must begin with an ASCII alphabetic or underscore C(_) character, and must contain only ASCII
alphanumeric, underscore C(_), hash C(#), period C(.), space C( ), colon C(:), at C(@), equals C(=), and hyphen C(-)
characters.
- "Can be changed after the name is created."
- "Minimum length = 1"
ipaddress:
description:
- >-
IPv4 or IPv6 address of the server. If you create an IP address based server, you can specify the
name of the server, instead of its IP address, when creating a service. Note: If you do not create a
server entry, the server IP address that you enter when you create a service becomes the name of the
server.
domain:
description:
- "Domain name of the server. For a domain based configuration, you must create the server first."
- "Minimum length = 1"
translationip:
description:
- "IP address used to transform the server's DNS-resolved IP address."
translationmask:
description:
- "The netmask of the translation ip."
domainresolveretry:
description:
- >-
Time, in seconds, for which the NetScaler appliance must wait, after DNS resolution fails, before
sending the next DNS query to resolve the domain name.
- "Minimum value = C(5)"
- "Maximum value = C(20939)"
default: 5
ipv6address:
description:
- >-
Support IPv6 addressing mode. If you configure a server with the IPv6 addressing mode, you cannot use
the server in the IPv4 addressing mode.
default: false
type: bool
comment:
description:
- "Any information about the server."
td:
description:
- >-
Integer value that uniquely identifies the traffic domain in which you want to configure the entity.
If you do not specify an ID, the entity becomes part of the default traffic domain, which has an ID
of 0.
- "Minimum value = C(0)"
- "Maximum value = C(4094)"
graceful:
description:
- >-
Shut down gracefully, without accepting any new connections, and disabling each service when all of
its connections are closed.
- This option is meaningful only when setting the I(disabled) option to C(true)
type: bool
version_added: "2.5"
delay:
description:
- Time, in seconds, after which all the services configured on the server are disabled.
- This option is meaningful only when setting the I(disabled) option to C(true)
version_added: "2.5"
disabled:
description:
- When set to C(true) the server state will be set to C(disabled).
- When set to C(false) the server state will be set to C(enabled).
- >-
Note that due to limitations of the underlying NITRO API a C(disabled) state change alone
does not cause the module result to report a changed status.
type: bool
default: false
extends_documentation_fragment: netscaler
requirements:
- nitro python sdk
s�
- name: Setup server
delegate_to: localhost
netscaler_server:
nsip: 172.18.0.2
nitro_user: nsroot
nitro_pass: nsroot
state: present
name: server-1
ipaddress: 192.168.1.1
s
loglines:
description: list of logged messages by the module
returned: always
type: list
sample: ['message 1', 'message 2']
msg:
description: Message detailing the failure reason
returned: failure
type: str
sample: "Action does not exist"
diff:
description: List of differences between the actual configured object and the configuration specified in the module
returned: failure
type: dict
sample: { 'targetlbvserver': 'difference. ours: (str) server1 other: (str) server2' }
( t server( t nitro_exception( t
AnsibleModule( t ConfigProxyt get_nitro_clientt netscaler_common_argumentst logt loglinest get_immutables_intersectionc C` s9 t d � t j | d | j d � d k r1 t St Sd S( Ns Checking if server existss name:%st namei ( R R t count_filteredt paramst Truet False( t clientt module( ( sV /usr/lib/python2.7/site-packages/ansible/modules/network/netscaler/netscaler_server.pyt
server_exists� s
#c C` s� t d � t j | d | j d � d k r1 t St | | | � } x* d d g D] } | | k rP | | =qP qP W| i k r� t St Sd S( Ns* Checking if configured server is identicals name:%sR i t gracefult delay( R R R R R t diff_listR ( R R t server_proxyt difft option( ( sV /usr/lib/python2.7/site-packages/ansible/modules/network/netscaler/netscaler_server.pyt server_identical� s
#c C` s5 | j t j | d | j d � d � f } | d S( Ns name:%sR i ( t diff_objectR t get_filteredR ( R R R t ret_val( ( sV /usr/lib/python2.7/site-packages/ansible/modules/network/netscaler/netscaler_server.pyR � s -c C` sR | j d r/ t d � t j | | j � } n t d � t j | | j � } | S( Nt disableds Disabling servers Enabling server( R R R t disablet actualt enable( R R R t result( ( sV /usr/lib/python2.7/site-packages/ansible/modules/network/netscaler/netscaler_server.pyt do_state_change� s
c C` s t d t d d � d t d d � d t d d � d t d d � d t d d � d t d d � d
t d d d t � d
t d d � d t d d � d t d d � d t d d � � } t d t d d d t � � } t � } | j t � | j | � | j | � t d | d t � } t d t d t d t � } t sK| j d d � n t | � } y | j
� Wn� t k
r�} d t | j
� | j f } | j d | � n� t k
r<} t t | � � d k r�| j d d t | � � q=t t | � � d k r| j d d t | � � q=| j d d t | � � n Xd d d d d d d
d d d
d g } d d! d"