�
�Udac @ s� d Z i d d 6d g d 6d d 6Z d Z d Z d Z d
d l Z d
d l Z d
d l m Z d
d
l m
Z
yB d
d l m Z m
Z
m Z m Z m Z d
d l m Z m Z Wn e k
r� e Z n Xd � Z e d k r� e � n d S( s*
# Created on Aug 12, 2016
#
# @author: Gaurav Rastogi ([email protected]) GitHub ID: grastogi23
#
# module_check: not supported
#
# Copyright: (c) 2017 Gaurav Rastogi, <[email protected]>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
#
s 1.1t metadata_versiont previewt statust communityt supported_bysc
---
module: avi_api_session
author: Gaurav Rastogi (@grastogi23) <[email protected]>
short_description: Avi API Module
description:
- This module can be used for calling any resources defined in Avi REST API. U(https://avinetworks.com/)
- This module is useful for invoking HTTP Patch methods and accessing resources that do not have an REST object associated with them.
version_added: 2.3
requirements: [ avisdk ]
options:
http_method:
description:
- Allowed HTTP methods for RESTful services and are supported by Avi Controller.
choices: ["get", "put", "post", "patch", "delete"]
required: true
data:
description:
- HTTP body in YAML or JSON format.
params:
description:
- Query parameters passed to the HTTP API.
path:
description:
- 'Path for Avi API resource. For example, C(path: virtualservice) will translate to C(api/virtualserivce).'
timeout:
description:
- Timeout (in seconds) for Avi API calls.
default: 60
extends_documentation_fragment:
- avi
s�
- name: Get Pool Information using avi_api_session
avi_api_session:
controller: "{{ controller }}"
username: "{{ username }}"
password: "{{ password }}"
http_method: get
path: pool
params:
name: "{{ pool_name }}"
api_version: 16.4
register: pool_results
- name: Patch Pool with list of servers
avi_api_session:
controller: "{{ controller }}"
username: "{{ username }}"
password: "{{ password }}"
http_method: patch
path: "{{ pool_path }}"
api_version: 16.4
data:
add:
servers:
- ip:
addr: 10.10.10.10
type: V4
- ip:
addr: 20.20.20.20
type: V4
register: updated_pool
- name: Fetch Pool metrics bandwidth and connections rate
avi_api_session:
controller: "{{ controller }}"
username: "{{ username }}"
password: "{{ password }}"
http_method: get
path: analytics/metrics/pool
api_version: 16.4
params:
name: "{{ pool_name }}"
metric_id: l4_server.avg_bandwidth,l4_server.avg_complete_conns
step: 300
limit: 10
register: pool_metrics
sW
obj:
description: Avi REST resource
returned: success, changed
type: dict
i����N( t
AnsibleModule( t deepcopy( t avi_common_argument_spect ansible_returnt avi_obj_cmpt cleanup_absent_fieldst HAS_AVI( t
ApiSessiont AviCredentialsc sU t d t d t d d d d d d g � d t d
d d t � d t d
d
� d t d
d � d t d
d d d � � } | j t � � t d | � } t s� | j d d � St � } | j | � t j
| j | j d | j
d | j d | j d | j d | j d | j �} | j } | j } t | j j d � � } | j j d d � � | j j d d � } | j j d d � } | j } | d k r�t j | � } n | j d }
d } |
d k } | r�t | � n i }
|
j i d d 6d d 6� d d g } d! d"