Ansible collections in IAG

Itential Automation Gateway (IAG) provides Ansible Collections support. Ansible Collections are a distribution format for Ansible content that can include playbooks, roles, modules, and plugins. You can install and use collections through Ansible Galaxy. To learn more about collections, see the official Ansible Collections documentation guide.

A complete set of REST APIs are available for clients to manage and execute Ansible collections. See the API Documentation section within the Automation Gateway UI for more information.

Discovery

The IAG server performs discovery of collections at startup time and maintains a cache of all managed collections in memory. You can determine the collections that are managed by providing either a single path or a list of directory paths in the IAG properties.yml configuration file. A recursive search of the directory paths is performed.

1#
2# Path(s) to the set of Ansible Collections you would like to invoke from IAG.
3# This can be set to either a single path or a list of paths.
4#
5# This is what a list of paths looks like:
6collection_path: ['/usr/share/ansible/collections', '/usr/share/ansible/collections2']

Install collections in IAG

Ansible collections can be installed from a tarball or from the Ansible Galaxy server using the {IAG_Url}/collections/install API.

Install a collection from Ansible Galaxy server

To install a collection via Ansible Galaxy server, use the API mentioned above from either Postman or the API Documentation section within the Automation Gateway UI.

The request object format is given below. Note that package_name is the name of the collection to be installed.

1{
2 "force": true,
3 "package_name": "string",
4 "server_params": {
5 "auth_url": "string",
6 "password": "string",
7 "token": "string",
8 "url": "string",
9 "username": "string"
10 },
11 "version": "string"
12}

Refresh collections in IAG

If new collections are installed and need to be discovered and cached by IAG, there are two ways to accomplish this:

  1. Use the /collections/refresh API from the API Documentation in IAG, or send a POST request to {IAG_url}/collections/refresh in Postman.
  2. From the IAG Collections UI, click the refresh icon.
IAG collections UI
1

Open the collections list

Select Ansible in the left navbar and then select Collections. A list of all the collections in IAG will display.

2

View collection details

Click on an individual collection in the list. Two cards (Modules and Roles) will appear side-by-side.

3

Search within a collection

Use the search bar to search for Modules and Roles in the collection.

4

Page through collection items

Use the pagination controls at the bottom of each card to page through a collection. These controls can also be used to set how many items to display at once.

Collections list