> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.itential.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.itential.com/_mcp/server.

# Inventory sources

> Overview of internal and external inventory sources in Itential Gateway and how to manage them.

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 Itential 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, 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 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 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 Gateway hostname or IP address.

* Example response:

```json
{
  "code": 200,
  "message": "Inventory refresh succeeded"
}
```

For more information, see [Viewing endpoints and methods](./interactive-devices#view-endpoints-and-methods).

#### Refresh from UI

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

![](file:products/automation-gateway/versions/iag4/guide/media/inventory_refresh_in_iag\(1\).png)

## Ansible and inventory devices

For legacy support, among other factors, 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, you can manage inventory devices via the GUI or RESTful API endpoints.

> **Note**
>
> Beginning with Gateway **2021.1**, Ansible will be the only integration that uses the `/devices` endpoint.

### Ansible group names

In Ansible, `all` is a reserved group name that implicitly contains every host and group in the inventory. Creating a custom group named `all` — for example, by syncing group names in from an external system — creates a conflict that prevents Gateway from parsing the inventory correctly. Affected operations (such as `ansible.builtin.shell`) will fail even if the target host is not a member of the group. Rename any custom `all` groups and update any workflows that reference them.

For more information, see [Ansible's default groups](http://docs.ansible.com/projects/ansible/latest/inventory_guide/intro_inventory.html#default-groups).

## 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           |

> **Info**
>
> See also: [Inventory integration variables](./integration-variables).

## Device inventory examples

#### Cisco ASA

```json
{
  "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

```json
{
  "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"
}
```