Developer Community

Reply
Highlighted
Frequent Contributor I

Ansible and the Aruba CX modules and use

I have been playing on the fringes of Ansible for a while and now have a real opportunity to use but find the module  offering very confusing

I believe there are currently 4 different CX offerings with Ansible

1) aruba-switch-ansible ( https://github.com/aruba/aruba-switch-ansible) which is limited by the scripts although uses the Rest Interface  for access

2) aruba-ansible-modules ( https://github.com/aruba/aruba-ansible-modules) which requires a module to install and uses the Rest Interface  for access

3) aoscx-ansible-collection (https://github.com/aruba/aoscx-ansible-collection) limited to the library scripts

4) aoscx-ansible-role ( https://github.com/aruba/aoscx-ansible-role )- limited to the library scripts

 

I always assumed that Cli driven commands would be the easiest for transition, but believe using the rest interface has more functionality.

 

There seems to limitations with a lot of the modules, but I wanted to build large configured using Jinja2 templates i.e. 30-40 bgp peers etc.

 

What is the best method/module should I use, and which module has longevity?

 

I have also had limited success with test some of these. 

Aruba Employee

Re: Ansible and the Aruba CX modules and use

Hi and3p!

 

I'm sorry you're finding the AOS-CX module support confusing, let me break it down and see if that helps!

 

1)  aruba-switch-ansible - this repository currently holds 2 modules in the library/ directory, these modules are utilizing SSH and CLI to execute commands for both AOS-CX and AOS-Switch. The recommended use for this module is for commands that our REST API modules do not currently support.

2) aruba-ansible-modules - this repository no longer maintains any AOS-CX modules. This repository contains Ansible modules using REST API for the following products: AOS-Switch, ArubaOS Controller, Activate, Airwave, Clearpass, and Instant.

3+4) aoscx-ansible-collection and aoscx-ansible-role are the same modules just implemented in Ansible's Collection and Role structure to allow for easy installation and use. These are where the REST API modules are written for AOS-CX.

 

In regards to your orginal use case, "I wanted to build large configured using Jinja2 templates i.e. 30-40 bgp peers etc. What is the best method/module should I use, and which module has longevity?"

 

I would say, use Ansible's template module to generate configurations based on a Jinja2 template, then use the arubaos_cx_ssh_cli module to have the device copy the configuration to itself, something like the following:

- name: Generate Config for Device
  template: src="{{config_template}}" dest="{{temp_config_file}}"

- name: Copy Generated Config to Running through TFTP
  arubaos_cx_ssh_cli:
    ip: "{{ip | default(ansible_host)}}"
    user: "{{user | default(ansible_user)}}"
    password: "{{password | default(ansible_password)}}"
    commands: ["copy tftp://{{tftp_server}}/{{temp_config_file}} running-config vrf mgmt"]

Hopefully this answers your question, let me know if the solution provided isn't what you were looking for!

Search Airheads
cancel
Showing results for 
Search instead for 
Did you mean: