Skip to content

Action Template

An Action Template (.duneact.yaml) defines standalone workflows that can be executed against existing deployments/resourcegroup/resource. Unlike Deployment Templates which create infrastructure, Action Templates perform operations on already-deployed resources — such as running maintenance scripts, rotating credentials, or reconfiguring services.

Before an action template can be used, it must be assigned to a target object (deployment, resource group, or resource — matching the template's scope). Once assigned, the action becomes available in the Dune Portal on that specific object and can be executed by a user.

Structure

---
schemaVersion: 1
name: rotate-credentials                  # kebab/snake case identifier
description: Rotate service account credentials
scope: deployment                         # object type this action can be assigned to
parameters:                               # optional — user inputs
  - name: serviceList
    type: string
    description: Comma-separated list of services to restart
variables:                                # optional — key/value pairs
  timeout: 300
steps:                                    # the workflow steps to execute
  - name: rotate-passwords
    type: script
    limit: "{{computenode.vmapp.fqdn}}"
    credential: customer-domain-admin
    variables:
      script: |
        # Rotate credentials here
        Restart-Service "{{parameters.serviceList}}"

Naming

Action template identifiers follow the same kebab/snake-case pattern as other templates, but also allow underscores:

  • Valid: rotate-credentials, install_hotfix, db-maintenance

Scope

The scope determines the object type this action can be assigned to — i.e. where in the Dune Portal it appears as an available action:

scope: deployment          # assignable to a deployment
scope: resourcegroup       # assignable to a resource group
scope: resource            # assignable to an individual resource

The scope also defines the context for expression resolution. Mustache expressions ({{...}}) in the action are evaluated against the selected object:

  • deployment — expressions can reference any resource in the deployment (e.g. {{resourcegroup.app.vmapp.fqdn}}).
  • resourcegroup — expressions are resolved within the selected resource group (e.g. {{computenode.vmapp.fqdn}}).
  • resource — expressions are resolved against the selected resource itself (e.g. {{this.fqdn}}).

Parameters

Action template parameters work the same as deployment template parameters — see Parameters. They are prompted to the user when executing the action.

Steps

The steps array (also accepted as actions or action) defines the workflow steps to execute. Each step is dispatched to AWX and runs as an Ansible playbook against the target host(s). The step type determines how it maps to AWX — as a job template, a workflow job template, or an ad-hoc command — and which properties apply.

Common properties

Property Applies to Mandatory Description
name all Yes Unique step identifier. For job and workflow types, the name must match the AWX (job/workflow) template to execute. For command and script types, the name is a free-form label and does not reference an AWX object.
displayName all No User-friendly step description (supports expressions).
type all No One of job, workflow, command, script. Defaults to job
limit all Yes except for resource scope Target host(s) — expression referencing a compute node FQDN. Omit for resource scope.
credential all No Credential to use for execution.
variables all No Key/value map passed to the step. For script steps, variables.script is required and holds the script body.
module command only Yes Ansible module reference (e.g. ansible.windows.win_reboot).
arguments command only No Arguments passed to the Ansible module.

Step Types

Type Description
job Executes an AWX job template
workflow Executes an AWX workflow job template
command Runs an Ansible ad-hoc command (specify module)

job — AWX job template

The step name is the AWX job template to execute. variables are passed as extra vars.

steps:
  - name: invoke-dbscripts
    type: job
    displayName: "Running DB refresh"
    limit: "{{computenode.vmdb.fqdn}}"
    variables:
      scriptfolder: \\dfs\share\scripts
      sqlinstance: "{{computenode.vmdb.fqdn}}"
      sqlport: 1433

workflow — AWX workflow job template

Same as job but references a workflow job template.

steps:
  - name: wf-install-package
    type: workflow
    variables:
      provider: chocolatey
      name:
        - googlechrome
        - notepadplusplus

command — Ansible ad-hoc command

Runs a single Ansible module against the target host. Requires module and typically arguments.

steps:
  - name: reboot-server
    type: command
    module: ansible.windows.win_reboot
    credential: customer-domain-server-admin
    arguments:
      msg: "Reboot initiated by Dune Action"
      reboot_timeout: 600
      pre_reboot_delay: 30

Example

An action template that allows start/stop/restart/status action on a windows service:

---
schemaVersion: 1
name: service-manager
displayName: Service Manager
scope: resource
description: Service Manager (Stop/Start/Restart/Status)
parameters:
  - name: name
    type: string
    description: Service Name (Technical Service Name & Wildcards Possible. E.g. Foo*)
  - name: action
    type: string
    description: Service Action (Stop/Start/Restart/Status)
steps:
  - name: invoke-psscript
    displayName: "Service: {{parameters.name}} Action: {{parameters.action}}"
    variables:
      script: |
        $Services = Get-Service "{{parameters.name}}"
        if (-not $Services) { throw "No services found ... Exiting." }
        switch ('{{parameters.action}}') {
          'stop' {
            foreach ($Service in $Services) {
              Write-Output "Stopping Service $($Service.Name) ..."
              $Service | Stop-Service
              Write-Output "Service $($Service.Name) Stopped."
            }
          }
          'start' {
            foreach ($Service in $Services) {
              Write-Output "Starting Service $($Service.Name) ..."
              $Service | Start-Service
              Write-Output "Service $($Service.Name) Started."
            }
          }
          'restart' {
            foreach ($Service in $Services) {
              Write-Output "Restarting Service $($Service.Name) ..."
              $Service | Restart-Service
              Write-Output "Service $($Service.Name) Started."
            }
          }
          'status' {
            foreach ($Service in $Services) {
              Write-Output "Service: $($Service.Name) (DisplayName: $($Service.DisplayName)), Status: $($Service.Status)."
            }
          }
        }

Next: Config Tasks