Actions define reusable operations you can execute against nodes in an inventory. This section explains how to create, configure, and delete actions.
Broker actions
When you enable createBrokerActions, Inventory Manager automatically creates four actions configured to built-in Gateway Manager broker services:
get-configset-configis-aliverun-command
Device Broker operations (such as those used in command templates and Configuration Manager) require actions with these specific names. These actions can point to either the default built-in broker services or your own custom Gateway Manager services.
If you enable createBrokerActions and also define custom actions in the actions parameter, the inventory is populated with both the built-in and custom actions. If a custom action has the same name as a built-in action, the custom action takes priority.
For more information about broker services, see Built-in broker services.
Create actions
You can create actions when creating an inventory or add them afterward.
Create actions during inventory creation
Include actions in the inventory creation request using the actions parameter. You can also use the createBrokerActions parameter to automatically populate the inventory with built-in broker service actions.
API endpoint: POST /inventory_manager/v1/inventories
Required roles: inventory:create
Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
name |
string | Yes | Name of the inventory |
description |
string | No | Description of the inventory |
groups |
array | Yes | RBAC groups that can access the inventory |
tags |
array | No | Tags for organizing and filtering inventories |
actions |
array | No | Custom actions to create with the inventory |
createBrokerActions |
boolean | No | When true, automatically creates built-in broker service actions |
defaultClusterId |
string | No (required if createBrokerActions is true) |
Default Gateway Manager cluster for built-in broker actions |
Example request:
This request creates an inventory with the default broker actions. This example specifies custom parameters for the run-command action , while the remaining actions (get-config, is-alive, and set-config) use the default parameters configured to the built-in broker services.
{
"name": "testInventory",
"description": "",
"groups": ["pronghorn_admin"],
"tags": ["development"],
"actions": [
{
"name": "run-command",
"action_type": "iag5-service",
"action_config": {
"service_name": "custom-iag5-service",
"cluster_id": "cluster_1"
},
"action_parameters": {
"command": "show version"
}
}
],
"createBrokerActions": true,
"defaultClusterId": "cluster_1"
}
Add actions to existing inventories
Add actions to an inventory after creation using the create action endpoint.
API endpoint: POST /inventory_manager/v1/inventories/:inventoryIdentifier/actions
Required roles: inventory:update
Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
inventoryIdentifier (path parameter) |
string | Yes | Inventory name or ID |
name |
string | Yes | Action name (unique within the inventory) |
action_type |
string | Yes | Action type (currently only iag5-service) |
action_config |
object | No | Static configuration for the action |
action_parameters |
object | No | Default parameters for the action |
For attribute details, see Inventory Manager concepts.
Example request:
{
"name": "run-command",
"action_type": "iag5-service",
"action_config": {
"service_name": "custom-iag5-service",
"cluster_id": "cluster_1"
},
"action_parameters": {
"command": "show version"
}
}
Configure IAG 5 service actions
For the iag5-service action type, configure the IAG 5 service to execute and which Gateway Manager cluster to route the execution to.
Action configuration
action_config: Static configuration that doesn't change between executions:
service_name: The IAG 5 service to executecluster_id: The Gateway Manager cluster to route execution to (optional, can be overridden by node attributes)
action_parameters: Default parameters that can be overridden at runtime, such as:
timeout: Execution timeout in seconds- Command-specific parameters
Example:
{
"name": "get-config",
"action_type": "iag5-service",
"action_config": {
"service_name": "get-config",
"cluster_id": "cluster_1"
},
"action_parameters": {
"timeout": 60
}
}
Parameter resolution
When Inventory Manager executes an action, it merges parameters from multiple sources with the following priorities:
- Runtime parameters (provided at execution)
- Action parameters (defaults in action definition)
- Action config (static configuration)
- Node attributes (from target node)
Example:
Action definition:
{
"name": "get-config",
"action_config": {
"service_name": "get-config",
"cluster_id": "cluster_1"
},
"action_parameters": {
"timeout": 60
}
}
Node attributes:
{
"name": "router-1",
"attributes": {
"cluster_id": "cluster_2",
"ipaddress": "10.1.1.1"
}
}
Runtime execution request:
{
"nodeIdentifier": "router-1",
"parameters": {
"timeout": 120,
"command": "show clock"
}
}
Merged parameters sent to IAG 5:
{
"service_name": "get-config",
"cluster_id": "cluster_2", // From node attributes
"timeout": 120, // From runtime parameters
"command": "show clock", // From runtime parameters
"ipaddress": "10.1.1.1" // From node attributes
}
For IAG 5 service actions, the cluster_id from node attributes takes precedence over all other sources, allowing you to route execution based on device properties.
Delete actions
Remove an action from an inventory using the delete action endpoint.
API endpoint: DELETE /inventory_manager/v1/inventories/:inventoryIdentifier/actions/:actionIdentifier
Required roles: inventory:delete
Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
| inventoryIdentifier (path parameter) | string | Yes | Inventory name or ID |
| actionIdentifier (path parameter) | string | Yes | Action name or ID |