AOS-CX

The AOS-CX Developer Hub

Welcome to the AOS-CX developer hub. You'll find comprehensive guides and documentation to help you start working with AOS-CX as quickly as possible, as well as support if you get stuck. Let's jump right in!

Get Started    

Ansible Inventories

An overview of Ansible inventories

What is an Ansible Inventory?

An inventory specifies and describes all of the target devices (i.e. hosts) in the Ansible environment. The inventory can be either a single file or a series of files, written typically in INI or YAML format. Defined in the file(s) are variables that Ansible will use to communicate with and configure the target systems. The inventory can contain various hosts of different platforms, operating systems, and manufacturers. Ansible doesn't care about the nature of the devices in the inventory, only that the inventory is formatted accurately!

Ansible offers a default inventory with the file /etc/ansible/hosts, which is used in Ansible Engine commands whenever an inventory is not explicitly specified. The location of the default inventory can be set by modifying the Ansible configuration file. While Ansible offers the choice to use the default inventory, it is preferable to explicitly supply a user-defined inventory by specifying the "-i" option in Ansible Engine commands.

Inventory Structure

It is not uncommon to see hundreds or even thousands of devices in a production environment. Keeping track of all their information can be difficult, so it is suggested that devices be logically organized into groups, or even groups of groups, in an inventory. Using groups and variable files will make inventory management less cumbersome and more workable. For a comprehensive tutorial on structuring and organizing your inventory, refer to How to build your inventory.

Example Inventory Structure

Below is an example of an inventory arrangement that features an INI inventory file "hosts," along with group and host variable files. The group variable files exist in the "group_vars" directory and the host variable files reside in the "host_vars" directory.

/etc/ansible
|   hosts
|   ...
└───group_vars
|   |   aoscx_switches.yml
|   |   ...
|
└───host_vars
    |   switch1.yml
    |   switch2.yml
    |   ...
[aoscx_switches]
switch1
switch2
 ansible_connection: httpapi  # Do not change
 ansible_network_os: aoscx
 ansible_httpapi_validate_certs: False
 ansible_httpapi_use_ssl: True
 ansible_acx_no_proxy: True
ansible_host: 10.0.0.1
ansible_host: 10.0.0.2

Updated about a year ago



Ansible Inventories


An overview of Ansible inventories

Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.