Documentation

avi_api_session - Avi API Module

New in version 2.3.

Synopsis

  • This module can be used for calling any resources defined in Avi REST API. 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.

Options

parameter required default choices comments
controller
no
IP address or hostname of the controller. The default value is the environment variable AVI_CONTROLLER.
data
no
HTTP body in YAML or JSON format.
http_method
yes
  • get
  • put
  • post
  • patch
  • delete
Allowed HTTP methods for RESTful services and are supported by Avi Controller.
params
no
Query parameters passed to the HTTP API.
password
no
Password of Avi user in Avi controller. The default value is the environment variable AVI_PASSWORD.
path
no
Path for Avi API resource. For example, path: virtualservice will translate to api/virtualserivce.
tenant
no admin
Name of tenant used for all Avi API calls and context of object.
tenant_uuid
no
UUID of tenant used for all Avi API calls and context of object.
timeout
no
Timeout (in seconds) for Avi API calls.
username
no
Username used for accessing Avi controller. The default value is the environment variable AVI_USERNAME.

Examples

- 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 }}"
  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 }}"
    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
    params:
      name: "{{ pool_name }}"
      metric_id: l4_server.avg_bandwidth,l4_server.avg_complete_conns
      step: 300
      limit: 10
  register: pool_metrics

Return Values

Common return values are documented here Return Values, the following are the fields unique to this module:

name description returned type sample
obj Avi REST resource success, changed dict


Status

This module is flagged as preview which means that it is not guaranteed to have a backwards compatible interface.

Support

This module is community maintained without core committer oversight.

For more information on what this means please read Module Support

For help in developing on modules, should you be so inclined, please read Community Information & Contributing, Helping Testing PRs and Developing Modules.