Ansible Collections Support
  • 07 Jun 2022
  • Dark
    Light
  • PDF

Ansible Collections Support

  • Dark
    Light
  • PDF

Article Summary

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. Users 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.

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

Installing Collections in IAG

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

Installing 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. Take note that package_name would be the name of the collection that needs to be installed.

{
  "force": true,
  "package_name": "string",
  "server_params": {
    "auth_url": "string",
    "password": "string",
    "token": "string",
    "url": "string",
    "username": "string"
  },
  "version": "string"
}

Refreshing Collections in IAG

If new collections are installed and need to be discovered and cached by IAG, there are two ways that can be accomplished.

  1. Use the API /collections/refresh from the API Documentation in IAG, or a POST request {IAG_url}/collections/refresh in Postman.
  2. The simpler way is to do it from the IAG Collections UI by clicking the Refresh icon.

Figure 1: IAG Collections UI
CollectionRefresh.png

To navigate the Collections UI:

  1. Select Ansible in the left navbar and then select Collections. A list of all the collections in IAG will display.
  2. Click on an individual collection in the list and two cards (Modules and Roles) will appear side-by-side.
  3. Use the search bar to search for Modules and Roles in the collection.
  4. 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 show if there are too many in a collection.

Figure 2: Collections List
CollectionUI.png


Was this article helpful?

Changing your password will log you out immediately. Use the new password to log back in.
First name must have atleast 2 characters. Numbers and special characters are not allowed.
Last name must have atleast 1 characters. Numbers and special characters are not allowed.
Enter a valid email
Enter a valid password
Your profile has been successfully updated.