Action Context

Actions are one of the most powerful ways people can extend CloudBolt. Aside from the ability to define action inputs there might be several CloudBolt objects available as context for any or all template-enabled action attributes (E.g. CloudBolt plug-in source, Webhook payload, Email hook body, etc). To understand the various attributes that can be templatized for each action type see Action Types.

Outside of actions, this context is also available when using custom YAML files to provision Kubernetes objects. See Container Orchestrators to learn more about using Kubernetes.

Built-in Context by Use-case

Single Server Action - run by user on an existing server
  • server - single Server object if there is only one
  • for remote script actions:
    • script_username, script_password - execute script as this user
Batch Server Action - run by user on one or more existing servers
  • context provided by single server action
  • servers - array of Server objects
Display Condition Plug-in for Server Action - determines when Server Action displays
  • server - this plug-in only ever operates on a single Server object at a time
  • request - the current request, which can be used to determine the user profile trying to see Server Actions for the Server
Resource Action - run on a deployed resource
  • resource
  • resource attributes - dict of key/value pairs like {“azure_website”: “”}
  • servers
Resource Action → Scale Up
  • service_item - the server tier selected by user
Blueprint Action - run during blueprint deployment
  • resource (if the BP creates a resource)
  • servers
Blueprint Action → Load Balancer
  • [blueprint action keys]
  • source_port
  • destination_port

Built-in Context for Special Cases

For the Email hook action type, CloudBolt provides a ‘job’ object. This may be used to include a link in the email body to the job detail view, via

View the details of this CloudBolt job:
https://CB-SERVER-NAME{{ job.get_absolute_url }}

Description of Context Keys

Key Description
The CloudBolt object for the blueprint associated with this action.
The CloudBolt object for the environment associated with this action.
The CloudBolt object for the group associated with this action.
The CloudBolt object for the job associated with this action.
Points at the single server CloudBolt object that applies for the action.
If more than one server is being worked on at the same time,
then use the servers key instead
List of servers objects directly related to the action being run.
Points at the resource CloudBolt object that applies for the action.
Supports direct parameter reference like {{resource.expiration_date}}.
Dictionary containing info on the blueprint being deployed. It includes
resource_name and a key for each build item in the blueprint. The key
is based on the slugified build item name. For more information on the
context available for each build item, see Blueprint Action Context.