Inventory Sources

Prev Next

While the functionality of each integration will remain the same regardless of how the inventory device is sourced (internal or external), it is important to understand how Automation Gateway will behave in each scenario.

Internal inventory

An Internal inventory source simply means that an External file path was not supplied, or not correctly loaded; therefore, you must manage your inventory exclusively through the GUI or APIs.

Pros Cons
Inventory can be fully managed via API calls for end-to-end automations that do not have access to the underlying file system. Certain inventory features of an integration must be adapted to fit inside of a JSON structure instead of other file formats supported by that integration (e.g., YAML for Ansible, etc.).

External inventory

An External inventory source indicates that you have provided the correct file path to the relevant inventory or configuration file for your integration. Because the external file serves as the source of truth, Automation Gateway cannot directly modify it, and the Internal inventory option is disabled. To update an External inventory, you must edit the file directly and then prompt Automation Gateway to refresh its inventory data.

Pros Cons
All native inventory options are available for each integration (for example, complex ini groups and variables with Ansible) The underlying file system must be kept up-to-date through file syncing protocols, scripts, cron jobs, or manual processes

Refresh external inventories

After modifying an external inventory file, refresh the inventory in Automation Gateway using one of the following methods:

Refresh endpoint

Refresh the inventory by calling the refresh endpoint: POST /inventory/refresh.

  • Example request URL: http://<iag-hostname>:8083/api/v2.0/inventory/refresh
Note

Replace <iag-hostname> with your Automation Gateway hostname or IP address.

  • Example response:
{
  "code": 200,
  "message": "Inventory refresh succeeded"
} 

For more information, see Viewing endpoints and methods.

Refresh from UI

Refresh the inventory from the Automation Gateway UI by selecting the Devices refresh icon.

Figure 1: Inventory refresh button in Automation Gateway UI
inventory_refresh_in_iag.png

Ansible and inventory devices

For legacy support, among other factors, Automation Gateway has two sets of endpoints for Inventory. The first are the /devices and /groups endpoints which are exclusively for use with Ansible (and Scripts by extension). The second is the /inventories endpoints which are for all inventory-enabled integrations besides Ansible. In either case, users can manage inventory devices via our GUI or RESTful API endpoints.

Note:

Beginning with Automation Gateway 2021.1, Ansible will be the only integration that uses the /devices endpoint.

Inventory device integration types

Each Inventory Device has an associated integration_type which is used when managing devices via API calls.

Integration Integration Type
HTTP Requests http_requests
NETCONF netconf
Netmiko netmiko
Nornir nornir

Device inventory examples

Cisco ASA

{
  "name": XXXXXX
  "variables":{
   "ansible_host": "XXX.XX.XXX.XX",
   "ansible_port": 22,
   "ansible_network_os": "asa",
   "ansible_connection": "network_cli",
   "ansible_user": "USERNAME",
   "ansible_password": "PASSWORD",
   "ansible_become": "yes",
   "ansible_become_method": "enable",
   "ansible_become_pass": "PASSWORD"
   }
}

Fortigate - Netmiko

{
  "ansible_host": "x.x.x.x",
  "ansible_user": "user",
  "ansible_password": "pass",
  "ansible_port": 22,
  "ansible_connection": "local",
  "netmiko_device_type": "fortinet",
  "get_config_command": "show full-configuration",
  "end_command": "exit",
  "get_state_command": "get system status",
  "save_command": "end"
}