Configuring Ansible for Avi Vantage

Setup

Installing Dependencies

  • Install the Avi SDK
pip install avisdk

Note: Starting with Ansible version 2.9 you need not install Avi SDK

  • Install the avinetworks.avisdk Ansible role.
ansible-galaxy install -f avinetworks.avisdk

For help using the module and understanding key value pairs, refer to the Avi API Guide.You can also find a visual representation of current values using https://<avicontroller>/api/. For example, https://10.10.27.90/api/virtualservice/.

Usage

Below is an example playbook.


- hosts: localhost
  connection: local
  vars:
    controller: 10.10.28.4
    username: admin
    password: avi123$%
    api_version: "17.2.8"
  roles:
    - avinetworks.avisdk
  tasks:
    - avi_pool:
        controller: ''
        api_version: ''
        username: ''
        password: ''
        name: testpool2
        state: present
        health_monitor_refs:
          - '/api/healthmonitor?name=System-HTTP'
        servers:
          - ip:
              addr: 10.90.130.8
              type: V4
          - ip:
              addr: 10.90.130.7
              type: V4
    - avi_virtualservice:
        controller: ''
        api_version: ''
        username: ''
        password: ''
        name: newtestvs
        state: present
        performance_limits:
          max_concurrent_connections: 1000
        ssl_profile_ref: '/api/sslprofile?name=System-Standard'
        application_profile_ref: '/api/applicationprofile?name=System-Secure-HTTP'
        ssl_key_and_certificate_refs:
          - '/api/sslkeyandcertificate?name=System-Default-Cert'
        vip:
          - ip_address:
              addr: 10.90.131.103
              type: V4
            vip_id: 1
        services:
          - port: 443
            enable_ssl: true
          - port: 80
        pool_ref: '/api/pool?name=testpool2'
Note: Starting with release 17.1.1, Avi Vantage supports API versioning for backward compatibility with automation scripts written for an object model older than the current one. Such scripts need not be updated to keep up with object model changes. Accordingly, playbook authors should set api_version to the oldest version of Avi Vantage in which their code can work. Refer to the API Versioning article (cited below).

Support for Ansible Collections

Starting with Avi Vantage release 21.1.1, the support for Ansible collection is available for Avi Vantage deployments. The Ansible collections are supported for Ansible version 2.9.10 or the later versions. The detailed information about installation and usage is available at`at Advanced Load Balancer (formerly Avi) Ansible Collection.

Additional References