### Run Ansible Playbook Example
Source: https://ansibleforms.com/forms/multistep.html
This example shows how to configure a form step to execute an Ansible playbook. It includes the step name, type as 'ansible', and the playbook file name.
```yaml
name: Delete vm
type: ansible
playbook: delete_vm.yaml
```
--------------------------------
### Run AWX Template Example
Source: https://ansibleforms.com/forms/multistep.html
This example demonstrates how to configure a form step to run an AWX template. It specifies the step name, type as 'awx', and the name of the AWX template to execute.
```yaml
name: Create vm
type: awx
template: Create VM
```
--------------------------------
### Define Form Help Documentation
Source: https://ansibleforms.com/forms
Example of using markdown within the help attribute to provide detailed instructions to operators.
```markdown
> #### The quarterly results look great!
>
> - Revenue was off the chart.
> - Profits were higher than ever.
>
> *Everything* is going according to **plan**.
```
--------------------------------
### Dynamic Template and Playbook Configuration
Source: https://ansibleforms.com/forms
Examples showing how to override static template or playbook names dynamically using form fields.
```yaml
name: Foobar
type: awx
template: HelloWorld
fields:
- name: __template__
type: text
default: Foobar
```
```yaml
name: HelloWorld
type: ansible
playbook: foobar.yaml
fields:
- name: __playbook__
type: text
default: helloworld.yaml
```
--------------------------------
### Approval Point Configuration
Source: https://ansibleforms.com/forms/multistep.html
This example configures an approval point for a form step. It includes a title, a custom message, roles for approvers, and notification recipients.
```yaml
approval:
title: Please approve removal
message: |
You need to approve the removal of $(field1).
Double check please.
roles:
- public
notifications:
- info@ansibleforms.com
```
--------------------------------
### Notification Configuration
Source: https://ansibleforms.com/forms/multistep.html
This example sets up email notifications for job status events within a form step. It specifies recipients and the conditions (e.g., 'success') under which notifications should be sent.
```yaml
notifications:
recipients:
- info@ansibleguy.com
onStatus:
- success
```
--------------------------------
### Configure Form Execution Types
Source: https://ansibleforms.com/forms
Examples for configuring different execution backends including AWX templates, native Ansible playbooks, and sequential multistep jobs.
```yaml
name: Create vm
type: awx
template: Create VM
```
```yaml
name: Delete vm
type: ansible
template: delete_vm.yaml
```
```yaml
name: Trigger awx job
type: multistep
steps:
- name: Create vm
type: awx
template: create_vm
- name: Start vm
type: awx
template: start_vm
```
--------------------------------
### Ansible Playbook with Vars Files
Source: https://ansibleforms.com/forms/multistep.html
This example shows how to include external variable files when running an Ansible playbook. The 'vars_files' attribute takes a list of YAML file paths.
```yaml
name: Foobar
type: ansible
playbook: foobar.yaml
vars_files:
- /home/vars/common.yaml
- /home/vars/special.yaml
```
--------------------------------
### Dynamic Inventory Configuration
Source: https://ansibleforms.com/forms/multistep.html
This example demonstrates how to dynamically set the inventory for a form step using an extravar. The '__inventory__' extravar can override the static 'inventory' attribute.
```yaml
inventory: my_inventory
# or for ansible core:
inventory:
- /path/to/inventory.yaml
# dynamically:
fields:
- name: __inventory__
type: text
default: my_dynamic_inventory
```
--------------------------------
### Configure Form Access and Categorization
Source: https://ansibleforms.com/forms
Examples demonstrating how to define form identity, assign RBAC roles for access control, and organize forms into categories.
```yaml
name: Create virtual machine
roles:
- vmAdmins
- vmOperators
```
```yaml
name: Delete virtual machine
categories:
- Vmware
- Decommissioning
```
--------------------------------
### Add AWX Credentials to Template
Source: https://ansibleforms.com/forms
This example shows how to specify AWX credentials to be used with a template. The `awxCredentials` property takes an array of credential names as defined in AWX. This allows for associating the necessary authentication or authorization details with the template execution.
```YAML
awxCredentials:
- my_credential_name
```
--------------------------------
### Dynamically Send Credentials using Extra Variables
Source: https://ansibleforms.com/forms
This example shows how to dynamically set AWX credentials using an `enum` field for user selection and an `expression` field to construct the `__awxCredentials__` extra variable. This allows credentials to be chosen at runtime.
```yaml
fields:
- name: my_ad_creds
type: enum
values:
- ad_prod
- ad_dev
default: ad_prod
- name: "__awxCredentials__"
type: expression
runLocal: true
expression: "['vmware_prod','$(my_ad_creds)']"
```
--------------------------------
### Dynamic Ansible Playbook Name
Source: https://ansibleforms.com/forms/multistep.html
This example demonstrates how to dynamically specify the Ansible playbook name for a form step. The '__playbook__' extravar allows overriding the static 'playbook' attribute.
```yaml
name: HelloWorld
type: ansible
playbook: foobar.yaml
fields:
- name: __playbook__
type: text
default: helloworld.yaml # this will overwrite the playbook name
```
--------------------------------
### Configure Email Notification on All Events (YAML)
Source: https://ansibleforms.com/forms/notifications.html
This example illustrates how to configure email notifications to be sent for all job events and statuses. It uses 'any' for 'onStatus' and lists all possible job events in 'onEvent', ensuring comprehensive notification coverage.
```yaml
notifications:
recipients:
- admin@ansibleguy.com
onStatus:
- any
onEvent:
- launch
- relaunch
- delete
- approve
- reject
```
--------------------------------
### Set AWX Execution Environment Dynamically
Source: https://ansibleforms.com/forms
This example demonstrates how to dynamically specify the AWX execution environment using an extra variable `__executionEnvironment__`. This allows for flexibility in choosing the execution environment per form or per step in a multi-step form. The `key` and `model` properties are used to create distinct extravars for each step.
```YAML
executionEnvironment: __executionEnvironment__
```
--------------------------------
### Dynamically Set Verbose Mode using Extra Variables
Source: https://ansibleforms.com/forms
This example demonstrates how to dynamically enable 'verbose mode' for an Ansible playbook run. Using the `__verbose__` extra variable allows overriding the static 'verbose' setting. The field must evaluate to a boolean.
```yaml
# Example of a field that could dynamically set verbose mode
fields:
- name: enable_verbose_mode
type: checkbox
label: Run in Verbose Mode
- name: "__verbose__"
type: expression
runLocal: true
expression: "$(enable_verbose_mode)"
```
--------------------------------
### Conditional Form Actions on Submit, Failure, and Success
Source: https://ansibleforms.com/forms/job-status-action.html
This example demonstrates a sequence of actions based on job status. The form is hidden on submit, shown again if the job fails, and the user is navigated home if the job succeeds. It utilizes `onSubmit`, `onFailure`, and `onSuccess` hooks with `hide`, `show`, and `home` attributes respectively.
```yaml
onSubmit:
- hide: 0 # hide on submit
onFailure:
- show: 0 # show if failed
onSuccess:
- home: 0 # go home if success
```
--------------------------------
### Clear and Hide Form on Submit
Source: https://ansibleforms.com/forms/job-status-action.html
This example demonstrates how to clear a form immediately after submission and then hide it after a 2-second delay using the `onSubmit` hook. It utilizes the `clear` and `hide` attributes.
```yaml
onSubmit:
- clear: 0 # clear form after submit
- hide: 2 # 2 seconds later, hide the form
```
--------------------------------
### Dynamically Set Host Limit using Extra Variables
Source: https://ansibleforms.com/forms
This example demonstrates how to dynamically specify a host pattern to limit the scope of an Ansible playbook run. The `__limit__` extra variable can be set using a number field or an expression, overriding the static 'limit' attribute.
```yaml
# Example of a field that could dynamically set the host limit
fields:
- name: target_hosts
type: text
label: Target Hosts
default: "*"
- name: "__limit__"
type: expression
runLocal: true
expression: "$(target_hosts)"
```
--------------------------------
### Dynamically Set Tags using Extra Variables
Source: https://ansibleforms.com/forms
This example shows how to dynamically specify a comma-separated list of tags for an Ansible playbook run. The `__tags__` extra variable can be set using a text field or an expression, overriding the static 'tags' attribute.
```yaml
# Example of a field that could dynamically set tags
fields:
- name: playbook_tags
type: text
label: Tags
default: ""
- name: "__tags__"
type: expression
runLocal: true
expression: "$(playbook_tags)"
```
--------------------------------
### Dynamic AWX Template Name
Source: https://ansibleforms.com/forms/multistep.html
This example illustrates how to dynamically set the AWX template name for a form step. The '__template__' extravar can be used to override the static 'template' attribute.
```yaml
name: Foobar
type: awx
template: HelloWorld
fields:
- name: __template__
type: text
default: Foobar # this will overwrite the template name
```
--------------------------------
### Configure onSubmit Event in Ansible Forms
Source: https://ansibleforms.com/forms
The onSubmit event is triggered the moment the submit button is pressed. An example shows hiding the form immediately upon submission.
```yaml
onSubmit:
- hide: 0 # hide on submit
```
--------------------------------
### Configure onSuccess Event in Ansible Forms
Source: https://ansibleforms.com/forms
The onSuccess event is triggered when a job finishes successfully. It accepts an array of valid job status action objects. An example shows how to navigate to the home page upon successful job completion.
```yaml
onSuccess:
- home: 0 # go home on success
```
--------------------------------
### Apply Background Colors to Fieldgroups with Bootstrap Classes
Source: https://ansibleforms.com/forms
This example shows how to set background colors for fieldgroups in Ansible Forms using Bootstrap's color helper classes. The `fieldGroupClasses` property accepts key-value pairs where keys are group names and values are Bootstrap background classes like `bg-info-subtle` or `bg-success-subtle`. This allows for distinct visual grouping of form fields.
```YAML
fieldGroupClasses:
groupname1: bg-info-subtle
groupname2: bg-success-subtle
```
--------------------------------
### Configure onFinish Event in Ansible Forms
Source: https://ansibleforms.com/forms
The onFinish event is triggered when a job completes, regardless of its success or failure status. Multiple actions can be chained, such as clearing and showing the form. The example includes clearing and showing the form immediately upon finish.
```yaml
onFinish:
- clear: 0 # clear and show on finish
- show: 0
```
--------------------------------
### Load Another Form on Success
Source: https://ansibleforms.com/forms/job-status-action.html
This example illustrates how to load a different form named 'Another form' after the current job completes successfully. It uses the `onSuccess` hook and the `load` attribute, which is available from v4.0.20 onwards. The previous job ID is passed as `__previous__jobid__`.
```yaml
onSuccess:
- load: 2,Another form # load another form after success
```
--------------------------------
### Set AWX SCM Branch Dynamically
Source: https://ansibleforms.com/forms
This example illustrates dynamically setting the SCM branch for AWX templates using the `__scmBranch__` extra variable. This provides flexibility in choosing the source control branch for template execution. In multi-step workflows, `key` and `model` properties enable setting distinct SCM branches for each step.
```YAML
scmBranch: __scmBranch__
```
--------------------------------
### Configure onFailure Event in Ansible Forms
Source: https://ansibleforms.com/forms
The onFailure event is triggered when a job does not complete successfully. It allows for actions like reloading the form after a specified delay. The example demonstrates reloading the form 3 seconds after failure.
```yaml
onFailure:
- load: 3 # reload form after failure after 3 seconds
```
--------------------------------
### Configure onAbort Event in Ansible Forms
Source: https://ansibleforms.com/forms
The onAbort event is triggered when a job is explicitly aborted. Actions can be defined to execute upon abortion, such as clearing the form after a delay. The example shows clearing the form 3 seconds after abort.
```yaml
onAbort:
- clear: 3 # clear form after abort after 3 seconds
```
--------------------------------
### Manage Failure Handling with Continue and Always
Source: https://ansibleforms.com/forms/multistep.html
Illustrates how to control multistep execution flow during failures using 'continue' to proceed after a failure and 'always' to ensure a step runs regardless of previous outcomes.
```yaml
name: Resize volume
type: multistep
steps:
- name: Send email
type: awx
template: email
continue: true
- name: Resize volume
type: awx
template: volume resize
- name: Load cmdb
type: awx
template: load cmdb
always: true
```
--------------------------------
### Define Two-Step Provisioning Form in Ansible Forms
Source: https://ansibleforms.com/forms/multistep.html
This YAML defines a multi-step form for server provisioning. It outlines the form's name, category, and the fields for each step ('Basic Configuration' and 'Network Settings'). The overall form fields are also detailed.
```yaml
name: Server Provisioning
category: Setup
steps:
- name: Basic Configuration
fields:
- server_name
- environment
- size
- name: Network Settings
fields:
- ip_address
- subnet
- gateway
fields:
- name: server_name
type: text
- name: environment
type: select
- name: size
type: select
- name: ip_address
type: text
- name: subnet
type: text
- name: gateway
type: text
```
--------------------------------
### Configure Variable Files for Ansible Forms
Source: https://ansibleforms.com/forms
Demonstrates how to load YAML files as constants to share variables across forms. Supports both relative paths (resolved via VARS_FILES_PATH) and absolute paths.
```yaml
varsFiles:
- common/database.yaml
varsFiles:
- /opt/shared/globals.yaml
- /etc/ansibleforms/env-prod.yaml
varsFiles:
- common/shared.yaml
- /opt/custom/overrides.yaml
```
--------------------------------
### Dynamically Send Credentials via Expressions
Source: https://ansibleforms.com/forms
Demonstrates how to use the __credentials__ field type with expressions to dynamically construct credential objects. This approach allows for local execution and hidden field management based on user-selected enum values.
```yaml
fields:
- name: my_vcenter_cred
type: enum
values:
- vcenter_prod
- vcenter_dev
default: ad_prod
- name: __credentials__
type: expression
runLocal: true
hide: true
expression: "{vcenter:'$(my_vcenter_cred)'}"
```
--------------------------------
### Implement Conditional Step Execution
Source: https://ansibleforms.com/forms/multistep.html
Shows how to use the 'ifExtraVar' property to conditionally run steps based on boolean values from form fields, such as checkboxes.
```yaml
name: Create something
type: multistep
steps:
- name: Create
type: awx
template: create
- name: Send email
type: awx
template: send mail
ifExtraVar: sendmail
fields:
- name: name
type: text
label: What to create ?
- name: sendmail
type: checkbox
label: Should I send an email ?
```
--------------------------------
### Navigate Home on Submit
Source: https://ansibleforms.com/forms/job-status-action.html
This snippet shows how to redirect the user to the home page immediately after form submission using the `onSubmit` hook and the `home` attribute.
```yaml
onSubmit:
- home: 0
```
--------------------------------
### Configure Multistep Extravar Scoping with Key
Source: https://ansibleforms.com/forms/multistep.html
Demonstrates how to use the 'key' attribute to restrict the extravars payload sent to specific steps in a multistep form. This allows steps to receive only relevant data subsets rather than the entire form payload.
```yaml
name: Resize volume
type: multistep
steps:
- name: Create datastore
type: awx
template: create_datastore
key: datastore
- name: Create vm
type: awx
template: create_vm
fields:
- name: datastore
type: text
model: datastore.name
- name: datastore_size
type: number
model: datastore.size
- name: vm
type: text
model: vm.name
- name: vm_size
type: number
model: vm.size
```
--------------------------------
### Form Configuration Properties
Source: https://ansibleforms.com/forms
Configuration schema for defining form appearance and behavior, including styling classes and execution parameters.
```APIDOC
## Configuration Properties
### Description
Defines the structure and behavior of an Ansible Form, including visual styling and backend execution settings.
### Parameters
- **tileClass** (string) - Optional - Bootstrap CSS classes for form tile background/foreground (e.g., "bg-warning text-light").
- **fieldGroupClasses** (object) - Optional - Key-value pairs mapping group names to Bootstrap background classes.
- **order** (integer) - Optional - Sorting order of the form in the list. Defaults to alphabetical.
- **inventory** (string) - Optional - Inventory name or YAML file path. Can be overridden by `__inventory__` extravar.
- **executionEnvironment** (string) - Optional - AWX execution environment name. Can be overridden by `__executionEnvironment__` extravar.
- **instanceGroups** (array/string) - Optional - AWX instance group names. Can be overridden by `__instanceGroups__` extravar.
- **scmBranch** (string) - Optional - SCM branch name. Can be overridden by `__scmBranch__` extravar.
- **awx** (string) - Optional - Name of the target AWX instance. Can be overridden by `__awx__` extravar.
- **awxCredentials** (array) - Optional - List of credential names to apply to the template.
### Request Example
```json
{
"name": "New job",
"icon": "plus",
"tileClass": "bg-success-subtle text-dark",
"order": 1,
"inventory": "production_inv",
"awx": "my_awx_instance"
}
```
### Response
#### Success Response (200)
- **status** (string) - Confirmation of configuration update.
```
--------------------------------
### Configure Form Icon
Source: https://ansibleforms.com/forms
Set a Font Awesome icon for a form, including its color, size, and overlay options. You can specify an icon name, color, size (xs, sm, lg, 2x, 3x, 5x, 7x, 10x), and an optional overlay icon with its own color and transformations. Note that an icon and an image cannot be used simultaneously.
```yaml
name: Delete virtual machine
icon: trash
```
```yaml
name: My Form
icon: server
iconColor: danger
```
```yaml
name: My Form
icon: server
iconSize: 5x
```
```yaml
name: Server Status OK
icon: server
overlayIcon: check
overlayIconColor: success
overlayIconTransform: shrink-6 up-7 right-7
```
```yaml
name: My Form
icon: circle
overlayIcon: check
overlayIconTransform: shrink-8 down-2
```
```yaml
name: Alert Status
icon: circle
overlayIcon: exclamation
overlayIconColor: danger
```
```yaml
name: My Form
icon: server
overlayIcon: check
overlayIconCircle: false
overlayIconColor: success
```
--------------------------------
### Style Form Tiles with Bootstrap Background Classes
Source: https://ansibleforms.com/forms
This snippet demonstrates how to apply Bootstrap background and text color classes to form tiles in Ansible Forms. It uses `tileClass` to assign classes like `bg-warning text-light` for a warning theme or `bg-success-subtle text-dark` for a success theme. These classes control the visual appearance of individual form elements.
```YAML
name: Cleanup jobs
icon: trash
tileClass: bg-warning text-light
```
```YAML
name: New job
icon: plus
tileClass: bg-success-subtle text-dark
```
--------------------------------
### Basic AnsibleForms Form Structure (YAML)
Source: https://ansibleforms.com/forms
Defines the fundamental structure of a form in AnsibleForms using YAML. It includes essential attributes like form name, type, playbook to execute, roles, categories, and fields for user input.
```yaml
forms:
- name: Create VM
type: ansible
playbook: playbooks/create_vm.yml
roles:
- admin
categories:
- Provisioning
fields:
- name: vm_name
type: text
label: VM Name
```
--------------------------------
### Configure Form Image
Source: https://ansibleforms.com/forms
Add an image to a form using a URL (local or remote) or a base64 encoded string. This is an alternative to using an icon. Supported formats include SVG and PNG. Ensure images are not excessively large for optimal performance.
```yaml
name: Add Windows Virtual Machine
image: |
data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My
5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyMyAyMyI+PHBhdGggZmlsbD
0iI2YzZjNmMyIgZD0iTTAgMGgyM3YyM0gweiIvPjxwYXRoIGZpbGw9IiNmMz
UzMjUiIGQ9Ik0xIDFoMTB2MTBIMXoiLz48cGF0aCBmaWxsPSIjODFiYzA2Ii
BkPSJNMTIgMWgxMHYxMEgxMnoiLz48cGF0aCBmaWxsPSIjMDVhNmYwIiBkPS
JNMSAxMmgxMHYxMEgxeiIvPjxwYXRoIGZpbGw9IiNmZmJhMDgiIGQ9Ik0xMi
AxMmgxMHYxMEgxMnoiLz48L3N2Zz4=
```
```yaml
name: Add Windows Virtual Machine
image: https://upload.wikimedia.org/wikipedia/commons/4/44/Microsoft_logo.svg
```
```yaml
name: Add Netapp storage
image: /assets/images/netapp.svg
```
--------------------------------
### Define Form Submission Actions
Source: https://ansibleforms.com/forms
Configures actions to be performed upon form submission, such as clearing the form or hiding UI elements after a delay.
```yaml
onSubmit:
- clear: 0
- hide: 2
```
--------------------------------
### Configure AWX Instance Groups Dynamically
Source: https://ansibleforms.com/forms
This snippet shows how to dynamically assign AWX instance groups using an extra variable `__instanceGroups__`. This can be a single string for one group or an array for multiple groups. For multi-step forms, `key` and `model` properties are used to define step-specific instance groups.
```YAML
instanceGroups: __instanceGroups__
```
--------------------------------
### Map Credentials to Objects in AnsibleForms
Source: https://ansibleforms.com/forms
Defines credential mapping where specific credential names are assigned to object keys. Supports fallback mechanisms using comma-separated values and regex patterns for flexible credential resolution.
```yaml
cred_vm: vcenter_creds
cred_ms: ad_creds
cred_netapp: cluster1,clusters2
cred_veeam: veeam_server[0-9],veeam
```
--------------------------------
### Configure Email Notification on Job Events (YAML)
Source: https://ansibleforms.com/forms/notifications.html
This configuration shows how to send email notifications for specific job lifecycle events such as launch, relaunch, approve, and reject. Multiple recipients can be listed, and the notification is triggered by the 'onEvent' attribute.
```yaml
notifications:
recipients:
- admin@ansibleguy.com
- auditor@ansibleguy.com
onEvent:
- launch
- relaunch
- approve
- reject
```
--------------------------------
### Add AWX Instance to Template Dynamically
Source: https://ansibleforms.com/forms
This snippet shows how to dynamically associate an AWX instance with a template using the `__awx__` extra variable. This allows for selecting specific AWX instances, especially when multiple are configured. For multi-step forms, `key` and `model` properties facilitate setting different AWX instances per step.
```YAML
awx: __awx__
```
--------------------------------
### Configure Text Overlay on Form Icon
Source: https://ansibleforms.com/forms
Add text as an overlay on a form's icon, useful for badges or labels. You can specify the text content, its position (top-left, top-right, bottom-left, bottom-right), and its color. The default position is bottom-left and the default color is success.
```yaml
name: New Feature
icon: star
overlayIconText: "New!"
overlayIconTextPosition: top-right
overlayIconTextColor: warning
```
```yaml
name: Notification
icon: bell
overlayIconText: "3"
overlayIconTextPosition: top-right
```
```yaml
name: Pending Items
icon: inbox
overlayIconText: "!"
overlayIconTextColor: warning
```
--------------------------------
### Add Static AWX Credentials to Template
Source: https://ansibleforms.com/forms
This snippet demonstrates how to statically define AWX credentials to be used with an Ansible Forms template. These credentials are listed directly under the `awx_credentials` key.
```yaml
awx_credentials:
- vmware_prod
- ad_prod
```
--------------------------------
### Configure AWX Inventory Dynamically
Source: https://ansibleforms.com/forms
This snippet illustrates how to dynamically set the inventory for AWX or Ansible Core using an extra variable named `__inventory__`. This method overrides any statically defined inventory. It's particularly useful in multi-step forms where inventory might change per step, requiring the use of `key` and `model` properties for step-specific extravars.
```YAML
inventory: __inventory__
```
--------------------------------
### Define Form Fields and Validation
Source: https://ansibleforms.com/forms
Defines the structure for form fields, including text inputs and regex-based email validation.
```yaml
fields:
- name : name
label: Your name
type: text
required: true
- name : email
label: Your email
type: text
regex:
expression: "^[A-Z0-9._%+-]+@[A-Z0-9.-]+\\.[A-Z]{2,4}$"
description: Please enter a valid email address
required: true
```
--------------------------------
### Job Status Events API
Source: https://ansibleforms.com/forms
This section describes the different job status events that can be configured in Ansible Forms. These events allow you to trigger specific actions based on the outcome of a launched job.
```APIDOC
## Job Status Events
### Description
Ansible Forms provides several events that are triggered based on the status of a launched job. These events allow for custom actions to be performed upon job completion, failure, or abortion.
### Events
#### `onSuccess`
* **Description**: Triggered when the job finishes successfully.
* **Added in version**: 3.1.0
* **Type**: array
* **Example**:
```yaml
onSuccess:
- home: 0
```
#### `onFailure`
* **Description**: Triggered when the job does not finish successfully.
* **Added in version**: 3.1.0
* **Type**: array
* **Example**:
```yaml
onFailure:
- load: 3
```
#### `onAbort`
* **Description**: Triggered when the job is aborted.
* **Added in version**: 3.1.0
* **Type**: array
* **Example**:
```yaml
onAbort:
- clear: 3
```
#### `onFinish`
* **Description**: Triggered when the job finishes, regardless of its status.
* **Added in version**: 3.1.0
* **Type**: array
* **Example**:
```yaml
onFinish:
- clear: 0
- show: 0
```
#### `onSubmit`
* **Description**: Triggered the moment the submit button is pressed.
* **Added in version**: 3.1.0
* **Type**: array
* **Example**:
```yaml
onSubmit:
- hide: 0
```
### Possible Job Status Actions
Refer to the `job-status-event` page for a comprehensive list of valid job status action objects.
```
--------------------------------
### Configure Email Notification on Job Failure (YAML)
Source: https://ansibleforms.com/forms/notifications.html
This configuration snippet demonstrates how to set up email notifications to be sent when a job fails. It specifies the recipient's email address and triggers the notification solely on the 'failed' job status.
```yaml
notifications:
recipients:
- info@ansibleguy.com
onStatus:
- failed
```
--------------------------------
### Dynamically Set Diff Mode using Extra Variables
Source: https://ansibleforms.com/forms
This snippet shows how to dynamically enable or disable 'diff mode' for an Ansible playbook. By setting the `__diff__` extra variable, the static 'diff' setting can be overridden. The field must evaluate to a boolean.
```yaml
# Example of a field that could dynamically set diff mode
fields:
- name: enable_diff_mode
type: checkbox
label: Run in Diff Mode
- name: "__diff__"
type: expression
runLocal: true
expression: "$(enable_diff_mode)"
```
--------------------------------
### Dynamically Set Check Mode using Extra Variables
Source: https://ansibleforms.com/forms
This snippet illustrates how to dynamically control the 'check mode' for an Ansible playbook run. By using a field named `__check__` as an extra variable, the static 'check' setting can be overridden. The field must evaluate to a boolean.
```yaml
# Example of a field that could dynamically set check mode
fields:
- name: enable_check_mode
type: checkbox
label: Run in Check Mode
- name: "__check__"
type: expression
runLocal: true
expression: "$(enable_check_mode)"
```
--------------------------------
### Configure Approval Point in YAML
Source: https://ansibleforms.com/forms/approval.html
This snippet demonstrates how to define an approval point within an AnsibleForms configuration. It utilizes placeholders for dynamic content and specifies authorized roles and notification recipients.
```yaml
approval:
title: Remove host $(vm.name) ?
message: |
You are about to remove vm $(vm.name).
Esx server : $(cluster.esxhost.name)
Status : $(vm.status)
Change request : $(cr.id)
roles:
- approvers
- vmwareadmin
notifications:
- vmware@domain.local
- approvers@domain.local
```
--------------------------------
### Dynamically Control Keep Extravars using Extra Variables
Source: https://ansibleforms.com/forms
This snippet illustrates how to control whether the extra variables JSON file is removed after an Ansible run. By setting the `__keepExtravars__` extra variable, the static 'keepExtravars' property can be overridden. The field must evaluate to a boolean.
```yaml
# Example of a field that could dynamically control keepExtravars
fields:
- name: persist_extravars
type: checkbox
label: Keep Extravars File
- name: "__keepExtravars__"
type: expression
runLocal: true
expression: "$(persist_extravars)"
```
=== COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.