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.

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
Service Action - run on a deployed service
  • service
  • service attributes - dict of key/value pairs like {“azure_website”: “http://example.com”}
  • servers
Service Action → Scale Up
  • service_tier - the server tier selected by user
Blueprint Action - run during blueprint deployment
  • service (if the BP creates a service)
  • 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
blueprint
The CloudBolt object for the blueprint associated with this action.
environment
The CloudBolt object for the environment associated with this action.
group
The CloudBolt object for the group associated with this action.
job
The CloudBolt object for the job associated with this action.
server
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
servers
List of servers objects directly related to the action being run.
service
Points at the service CloudBolt object that applies for the action.
Supports direct parameter reference like {{service.expiration_date}}.
blueprint_context
Dictionary containing info on the blueprint being deployed. It includes
service_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.