Thunder® ADCs (Application Delivery Controllers) are high-performance solutions to accelerate and optimize critical applications to ensure delivery and reliability.
A10 Ansible modules is a custom plugin to do configurations on Thunder. It includes example playbooks to apply on hardware and virtual appliances.
We only support Ansible version >=2.9
This code is now being generated using the SDK generator at https://github.com/a10networks/sdkgenerator
For older versions, please visit https://galaxy.ansible.com/ui/repo/published/a10/acos_axapi/
- Install Ansible on your local OS, Please refer below sections for more details.
- Search required Ansible configuration from examples. In case not found create a new one, Please refer below sections for more details.
- Execute Ansible playbooks to apply thunder configuration, Please refer below sections for more details.
- Verify thunder configuration after ansible playbook is applied, Please refer below sections for more details.
To install Ansible on Ubuntu, Run the following command to download and install the latest version of Ansible:
apt install ansible
To install Ansible on MacOS, Run the following command to download and install the latest version of Ansible:
brew install ansible
a10-acos-axapi is collection of custom ansible modules crated by a10Networks. It can be installed using following ways, it is assumed that ansible is already installed and configured.
ansible-galaxy collection install a10.acos_axapi
Be sure to note the collection path found within the output of the above command. For example:
$ ansible-galaxy collection install a10.acos_axapi
Process install dependency map
Starting collection install process
Installing 'a10.acos_axapi:1.0.0' to '/opt/.ansible/collections/ansible_collections/a10/acos_axapi'
In this example the collection directory path is: /opt/.ansible/collections/ansible_collections/
git clone https://github.com/a10networks/a10-acos-axapi
cd a10-acos-axapi
ansible-galaxy collection build
ansible-galaxy collection install a10-acos_axapi*.tar.gz -p ./collections
Add below line in the /etc/ansible/ansible.cfg
file
action_plugins = <collection-dir-path>/a10/acos_axapi/plugins/action
-
Copy action plugin into one of the following
- ~/.ansible/plugins
- /usr/share/ansible/plugins folder
-
Export following environment variables for new session
export ANSIBLE_ACTION_PLUGINS=<collection-dir-path>/a10/acos_axapi/plugins/action
- Save this variable in .bashrc File
export ANSIBLE_ACTION_PLUGINS=<collection-dir-path>/a10/acos_axapi/plugins/action
Ansible collections are a powerful way to organize and distribute Ansible content, such as roles, modules, and plugins.
Action and module names are formatted based upon their API endpoint. For example, the virtual server endpoint is as follows: /axapi/v3/slb/virtual-server. As such, the action name is a10_slb_virtual_server and the module is a10_slb_virtual_server.py.
**Note that when getting information, changes made to the playbook will not result in a create, update or delete as the state has been put into no-op.
Any of the following method can be used to create and run playbooks.
collections:
- a10.acos_axapi
tasks:
- module_name:
- argument
- module_name:
- argument
tasks:
- a10.acos_axapi.module_name:
- argument
- a10.acos_axapi.module_name:
- argument
- name: <Description of playbook> connection: local hosts: <inventory_hostname> tasks: - name: <Description of task> <a10.acos_axapi.module_name>: <resource_key>: <resource_val> <another_resource_key>: <another_resource_val> state: absent
- name: <Description of playbook> connection: local hosts: <inventory_hostname> tasks: - name: <Description of task> <a10.acos_axapi.module_name>: <resource_key>: <resource_val> <another_resource_key>: <another_resource_val> state: noop get_type: single
- name: <Description of playbook> connection: local hosts: <inventory_hostname> tasks: - name: <Description of task> <a10.acos_axapi.module_name>: <resource_key>: <resource_val> <another_resource_key>: <another_resource_val> state: noop get_type: list
- name: <Description of playbook> connection: local hosts: <inventory_hostname> tasks: - name: <Description of task> <a10.acos_axapi.module_name>: <resource_key>: <resource_val> <another_resource_key>: <another_resource_val> state: noop get_type: oper
- name: <Description of playbook> connection: local hosts: <inventory_hostname> tasks: - name: <Description of task> <a10.acos_axapi.module_name>: <resource_key>: <resource_val> <another_resource_key>: <another_resource_val> state: noop get_type: stats
- name: <Description of playbook> connection: local hosts: <inventory_hostname> tasks: - name: <Description of task> <a10.acos_axapi.module_name>: a10_partition: {{ partition_name }} <resource_key>: <resource_val> <another_resource_key>: <another_resource_val>
- name: <Description of playbook> connection: local hosts: <inventory_hostname> tasks: - name: <Description of task> <a10.acos_axapi.module_name>: a10_device_context_id: {{ device_context_id }} <resource_key>: <resource_val> <another_resource_key>: <another_resource_val>
Note: Only available in modules with file_path
argument
- name: <Description of playbook> connection: local hosts: <inventory_hostname> tasks: - name: <Description of task> <a10.acos_axapi.module_name>: file_path: "/path/to/file" <resource_key>: <resource_val> <another_resource_key>: <another_resource_val>
Check mode can be specified in two ways:
- name: <Description of playbook> connection: local hosts: <inventory_hostname> tasks: - name: <Description of task> <a10.acos_axapi.module_name>: <resource_key>: <resource_val> <another_resource_key>: <another_resource_val> check_mode: yes
or
$ ansible-playbook -i <path_to_inventory> <playbook_name>.yml --check-mode
To search for a Ansible Module Configuration in the existing examples, perform the following steps:
-
Search the required Ansible Module configuration script directory navigate to examples > single_task directory.
Example:
If you want to apply the bgp router configuration on Thunder, search for the bgp directory under the single_task directory.
-
Open the Ansible playbook from the directory.
Example:
Open a10_bgp_create.yaml playbook under the single_task directory.
-
Update the hosts parameter in playbook and add, modify, or remove the Ansible module configuration parameters and their corresponding values as appropriate.
- name: Create bgp example playbook
connection: local
hosts: "{{desired_inventory_group}}"
tasks:
- name: Create router bgp for acos
a10.acos_axapi.a10_router_bgp:
as_number: 106
- Save the playbook.
Here are step-by-step instructions for creating ansible playbook example. For example if you want to apply bgp router configuration on thunder and which doesn't exist in examples.
- Create a new directory to house your ansible playbook files.
mkdir bgp
cd bgp
- Create a
.yaml
file, such asa10_bgp_create.yaml
, in your "bgp" directory. In this file, define the ROUTER BGP configurations. Refer to the official documentation: https://documentation.a10networks.com/docs/IaC/Ansible/ansible/ for the required parameters.
Here is basic example:
- name: Create bgp example playbook
connection: local
hosts: "{{desired_inventory_group}}" # Replace with your desired hosts
tasks:
- name: Create router bgp for acos
a10.acos_axapi.a10_router_bgp: # Replace with your desired module name
as_number: 106 # Replace with your desired bgp number
Adjust the BGP configuration parameters as needed.
Sample Inventory file:
[vthunder]
<vthunder host_name/ip_address>
[vthunder:vars]
ansible_username=<username>
ansible_password=<password>
ansible_port=<port>
If you want to use an Inventory file to perform respective configurations through a playbook, you don't need to specify ansible_host
, ansible_username
, ansible_password
and ansible_port
in the playbook.
For example,
- name: <Description of playbook>
connection: local
hosts: <inventory_hostname>
collections:
<a10.acos_axapi>
tasks:
- name: <Description of task>
<module_name>:
<resource_key>: <resource_val>
<another_resource_key>: <another_resource_val>
Use the following command to run playbook using an Inventory file parameters:
ansible-playbook -i <path_to_inventory> <name_of_playbook>
If you don't want to use Inventory file, then specify ansible_host
, ansible_username
, ansible_password
and ansible_port
arguments into playbook itself with hosts as localhost
. And then the configurations will be performed on provided ansible_host
.
For example,
- name: <Description of playbook>
connection: local
hosts: localhost
collections:
<a10.acos_axapi>
tasks:
- name: <Description of task>
<module_name>:
ansible_host: {{ ansible_host }}
ansible_username: {{ ansible_username }}
ansible_password: {{ ansible_password }}
ansible_port: {{ ansible_port }}
<resource_key>: <resource_val>
<another_resource_key>: <another_resource_val>
Use the following command to run the playbook with local arguments:
ansible-playbook <name_of_playbook>
Use the following command to run the playbook:
ansible-playbook -i <path_to_inventory> <name_of_playbook>
To verify the applied configurations, follow below steps:
-
SSH into the Thunder device using your username and password.
-
Once connected, enter the following commands:
Please refer : /examples/single_task/admin/adminPassword/README.md
If you have created a new example, please save the playbook file with a module-specific name, such as 'a10_bgp_create.yaml,' in a module name directory, like 'bgp'.
- Clone the repository.
- Copy the newly created playbook directory and place it under the /examples/single_task directory.
- Create a MR against the master branch.
A10 Thunder AXAPI support documentation available at https://documentation.a10networks.com/docs/IaC/Ansible/ansible/
Sample test cases added for the following configurations:
- Bgp
- Check Mode
- Class List
- Default Gateway
- files
- Gslb
- Health
- Network
- Slb
- Slb Template
To test configurations on the acos using ansible playbooks goto test
directory and use the following command:
sh run_test_playbooks.sh
All rights reserved @A10 Networks Inc.
For more information, please refer [/OPEN-SOURCE-DISCLAIMER.pdf]
For more open source licenses, please refer [/LICENSES]
Please raise issue in github repository. Please include the Ansible playbook or ansible module files that demonstrates the bug and the command output and stack traces will be helpful.
For all issues, please send an email to [email protected]