Create and manage actions
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:
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.
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:
For attribute details, see Inventory Manager concepts.
Example request:
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:
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:
Node attributes:
Runtime execution request:
Merged parameters sent to IAG 5:
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: