avinetworks.aviconfig
DEPRECATED
⛔️ DEPRECATED: This repository is not supported anymore. Please use https://github.com/vmware/ansible-collection-alb instead, as this role has been moved to ansible collections.
This role lets users configure Avi by simply providing a list of Avi configuration parameters. It runs the necessary Avi Ansible modules in the right order to ensure successful setup.
Requirements
- Python version 2.7 or higher
- avisdk
You need Ansible version 2.2 or higher. Required packages are listed in the metadata file.
Please install avisdk using pip before running this module:
pip install avisdk --upgrade
Installation
To install the aviconfig Ansible Module, run the following command on the machine where you will use Ansible:
ansible-galaxy install avinetworks.aviconfig
For more details, visit http://docs.ansible.com/ansible/galaxy.html
Role Variables
avi_config
This variable is a list of all the Avi REST resources you want to configure. The aviconfig role uses the Avi Ansible Modules to apply these settings in the Avi Controller. Example:
- name: Define Avi configuration
set_fact:
avi_config:
pool:
- name: "foo-pool"
lb_algorithm: LB_ALGORITHM_ROUND_ROBIN
servers:
- ip:
addr: "42.42.42.42"
type: 'V4'
virtualservice:
- name: foo
services:
- port: 80
pool_ref: "/api/pool?name=foo-pool"
vip:
- ip_address:
addr: "10.10.10.10"
type: 'V4'
vip_id: '1'
- name: Setup Foo in Avi Application
import_role:
name: avinetworks.aviconfig
vars:
avi_config: "{{avi_config}}"
avi_config_file
This variable points to where to read the Avi configuration objects. It will load the avi_config variable from this file if it is defined. Example:
- name: Setup VMWare Cloud with Write Access
import_role:
name: avinetworks.aviconfig
vars:
avi_config_file: application/config.yml
avi_creds_file
This variable specifies the location of the credential variables for the Avi Controller. It is usually an Ansible vault file. Example:
- name: Setup VMWare Cloud with Write Access
import_role:
name: avinetworks.aviconfig
vars:
avi_config_file: application/config.yml
avi_creds_file: credentials/creds.yml
avi_config_state
This variable is a global option to delete all Avi REST objects listed in the avi_config. This is useful if you want to reset the configuration and remove all objects.
avi_config_state=absent
Example: ansible-playbook site_applications.yml --extra-vars "site_dir=`pwd` avi_config_state=absent"
Example Playbooks
---
- hosts: localhost
connection: local
roles:
- role: avinetworks.avisdk
tasks:
- name: Setup foo in Avi Application
import_role:
name: avinetworks.aviconfig
vars:
avi_config_file: "foo/config.yml"
avi_creds_file: "vars/creds.yml"
This example shows how to create the avi_config as part of a task and pass it to the role.
---
- hosts: localhost
connection: local
roles:
- role: avinetworks.avisdk
tasks:
- name: Define Avi configuration
set_fact:
avi_config:
pool:
- name: foo-pool
lb_algorithm: LB_ALGORITHM_ROUND_ROBIN
servers:
- ip:
addr: 42.42.42.42
type: V4
virtualservice:
- name: foo
services:
- port: 80
pool_ref: "/api/pool?name=foo-pool"
vip:
- ip_address:
addr: 10.10.10.10
type: V4
vip_id: '1'
- name: Setup foo in Avi Application
import_role:
name: avinetworks.aviconfig
vars:
avi_config: "{{avi_config}}"
avi_creds_file: "vars/creds.yaml"
More examples can be found at https://github.com/avinetworks/devops/tree/master/ansible.
License
Apache 2.0
Author Information
Gaurav Rastogi
GitHub: grastogi23
Ansible role to configure Avi
ansible-galaxy install avinetworks.aviconfig