- 24 Jun 2024
-
DarkLight
-
PDF
Ansible Collections in IAG
- Updated on 24 Jun 2024
-
DarkLight
-
PDF
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.
- Use the API
/collections/refresh
from the API Documentation in IAG, or a POST request{IAG_url}/collections/refresh
in Postman. - The simpler way is to do it from the IAG Collections UI by clicking the refresh icon.
Figure 1: IAG Collections UI
Navigating Collections UI
To navigate the Collections UI:
- Select Ansible in the left navbar and then select Collections. A list of all the collections in IAG will display.
- Click on an individual collection in the list and two cards (Modules and Roles) will appear side-by-side.
- Use the search bar to search for Modules and Roles in the collection.
- 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