This section discusses about Ansible Playbook.
Use the following commands to install Ansible and NSX Advanced Load Balancer Python SDK:
NSX Advanced Load Balancer Python SDK - pip install avisdk
Starting with Ansible version 2.9 you need not install Avi SDK.
Install avinetworks.avisdk
Ansible role using the following command:
ansible-galaxy install -f avinetworks.avisdk
Use the following commands to download the required Ansible roles:
ansible-galaxy install avinetworks.avicontroller_kvm
ansible-galaxy install avinetworks.avise_kvm
Example
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'
NSX Advanced Load Balancer 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 NSX Advanced Load Balancer in which their code can work.
The support for Ansible collection is available for NSX Advanced Load Balancer 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 Advanced Load Balancer Ansible Collection.