HomeGuidesAPI Reference
GuidesAPI ReferenceGitHubAirheads Developer CommunityLog In

AOS-CX Data Center Automation with Ansible

Our vision at Aruba is accelerating Data Center automation by leveraging the power of AOS-CX. We've developed a set of Ansible workflows that allow for turnkey Day 0 automation of an AOS-CX Data Center deployment. These workflows, using playbooks and inventories, are based on the three Validated Reference Designs (VRDs) below.


The project repository containing these workflows and other relevant files is located on Github:

DCN Architectures

The VRDs have been posted on the Aruba Airheads Community:

Architecture III - Layer 3 Spine/Leaf Topology

Project Prerequisites

These workflows can be run on any Unix-based system.


  • The Ansible control machine must have Python3.5+ and at least Ansible 2.9 installed. See Ansible Documentation for more information on Ansible installation.

  • This project requires the AOS-CX Ansible Collection to be installed. The easiest way to install the collection is by executing the ansible-galaxy command on the requirements.yml file:
    $ ansible-galaxy install -r requirements.yml
    For more information on how to use the aoscx Collection visit our Getting Started with Ansible and AOS-CX guide.

  • This project requires the Python libraries listed below to be installed. The easiest way to install the required libraries is using the pip command on the requirements.txt file:
    $ pip install -r requirements.txt

Inventory Setup

This project contains multiple inventories, each corresponding to a specific workflow. Which inventory files correspond to which workflows is described in the pages detailing each workflow.

AOS-CX DCN Inventory Plugin

Typically, YAML or INI files are used to define their Ansible inventory. In this project, we use multiple YAML inventory files that correspond to specific workflows. You'll also find in the project an Ansible inventory plugin. An inventory plugin allows you to customize the data source from which an inventory is dynamically generated before the execution of each playbook. We've created the AOS-CX Data Center Networking inventory plugin inventory_plugins/aoscx_dcn_plugin.py, which allows users to input data into an Excel file, from which Ansible then generates inventory information to use to configure devices.

Each workflow uses a specific Excel template to generate Ansible inventory information. These Excel files are located in files/. You can rename the files to your liking. Furthermore, values in these files can (and should) be modified to match your environment and specifications. Once your Excel file is fully defined, you simply need to update the appropriate dynamic inventory file with the name of the inventory plugin, the path to the directory containing the Excel file, and the name of the Excel file to be read, like so:

plugin: aoscx_dcn_plugin           # Name of the plugin
path_to_inventory: ./files # Directory location of Excel
excel_file: dedicated_two_tier_DCN_Settings.xlsx # Name of the Excel

When it comes to playbook execution, you simply specify the aforementioned dynamic inventory file in the ansible-playbook command with the -i option:

ansible-playbook deploy_2tier_dedicated_datacenter.yml -i dynamic_2tier_dedicated_dc_inventory.yml

Making The Inventory Your Own

In this project, we have two options for defining the environment. We can use either a static YAML inventory file and modify the variables or the aoscx_dcn_plugin in conjunction with an Excel template. Either approach works with the provided playbooks, but you should choose one or the other.

Each inventory provided is intended as an example. You are encouraged to customize IP addressing and interface values for your environment.

Note that these inventories logically group switches by VSX pairs and assume that each VSX pair of access/leaf switches is one group. The default "rack" nomenclature in the inventory is so because two VSX-paired switches are often placed in the same rack, with that rack containing just that one VSX pair. This is just one approach to grouping VSX pairs; you can change the "rack#" nomenclature in the example inventory files to your liking as long as you keep the names consistent throughout the inventory.

aoscx_dcn_plugin + Excel Templates

Each workflow has an associated Excel template in files/. In the Excel template, modify the values to match the desired configuration parameters for your environment. Note that certain cells in the Excel file are used by the aoscx_dcn_plugin to interpret the spreadsheet; these cells should not be touched. Other cells, containing sample values, can be changed or modified. Some of these cells contain valid default values that can be left unchanged.


In the event that it's required to unprotect the sheets in the workbook, use the password aruba to unlock the sheets.

  • Examples of cells you should not change:
    Protected Cells
    Protected Cells
  • Examples of cells you can change:
    Value Cells
    Value Cells