Each step is a new form destination. And steps are executed sequentially. Use specific properties like continue, always and ifExtraVar to control the flow of a multistep form.
Attribute
Comments
basic
name string / required
The name of the form alphanumeric + dash + underscore + space
The name of the step. Used for logging and visualization.
type string
Step type
Every step can be an ansible-playbook or an awx-template
Choices:
ansible
awx
Examples:
1) Run AWX Template Helloworld
name:Create vmtype:awxtemplate:Create VM
2) Run Ansible playbook
name:Delete vmtype:ansibletemplate:delete_vm.yaml
template string
Awx template a valid awx template name
This attribute is only used when the form type is awx. When using native Ansible, use the property playbook.
Note : You can also dynamically set the template by using a field called __template__. It must be sent as extravar. If this extravar is found it will overwrite the static template name. Note : If you use multistep and you want to dynamically set every step, use the key property and model property to create separate extravars per step.
Only available with types: awx
Examples:
1) Run AWX Template Helloworld
name:Helloworldtype:awxtemplate:Helloworld
2) Use dynamic template name
name:Foobartype:awxtemplate:HelloWorldfields:-name:__template__type:textdefault:Foobar# this will overwrite the template name
playbook string
Ansible playbook a valid yaml file
This attribute is only used when the form type is ansible. When using awx, use the property template.
Note : You can also dynamically set the playbook by using a field called __playbook__. It must be sent as extravar. If this extravar is found it will overwrite the static playbook name. Note : If you use multistep and you want to dynamically set every step, use the key property and model property to create separate extravars per step.
Only available with types: ansible
Examples:
1) Run foobar playbook
name:Foobartype:ansibleplaybook:foobar.yaml
2) Use dynamic playbook name
name:HelloWorldtype:ansibleplaybook:foobar.yamlfields:-name:__playbook__type:textdefault:helloworld.yaml# this will overwrite the playbook name
vars_files array
Ansible vars_files list of valid yaml files
This will load yaml files with contain dictionaries of variables. These dict variables will be available in the form to use as constants. Adivise is to make the dict-keys unique and UPPERCASE to avoid conflicts with other variables.
Ansible Forms allows to add an approval point before a job is ran. An approval link is sent by email to a specific approver who can then approve or reject the job. Every step can have a differnt approval point.
Examples:
1) Approve removal
approval:title:Please approve removalmessage:|You need to approve the removal of $(field1). Double check please.roles:-publicnotifications:-info@ansibleforms.com
notifications object
Add Notification valid notification object
Add email notifications on job status events. Every step can have its own notifications
In both awx and ansible core you can pass an inventory. In the case of ansible core, it will be a yaml file. In case of awx it will be the inventory name.
Note : You can also dynamically set the inventory by using a field called __inventory__. It must be sent as extravar. If this extravar is found it will overwrite the static inventory. Note : Ansible core allows multiple inventories (so you can use an array), however awx does not support multiple inventories. Note : If you want to dynamically set every step, use the key property and model property to create separate extravars per step.
check boolean
Run in check mode
In both awx and ansible core you run a playbook in check mode. Enable this attribute to do so.
Note : You can also dynamically set the check mode by using a field called __check__. It must be sent as extravar. If this extravar is found it will overwrite the static check field. The field must result in a boolean (expression or checkbox) Note : If you want to dynamically set every step, use the key property and model property to create separate extravars per step.
diff boolean
Run in diff mode
In both awx and ansible core you run a playbook in diff mode. Enable this attribute to do so.
Note : You can also dynamically set the check mode by using a field called __diff__. It must be sent as extravar. If this extravar is found it will overwrite the static diff field. The field must result in a boolean (expression or checkbox) Note : If you want to dynamically set every step, use the key property and model property to create separate extravars per step.
tags string
Set tags comma separated tag-list
In both awx and ansible core you can pass tags. Use this attribute to pass a comma separted list of tags.
Note : You can also dynamically set the tags by using a field called __tags__. It must be sent as extravar. If this extravar is found it will overwrite the static tags. Note : If you want to dynamically set every step, use the key property and model property to create separate extravars per step.
key string
Extravar key valid extravar reference
Ansible Forms can model the extravars into objects using the formfield model attribute. In a multistep form, by default, every step gets the full extravars payload. However, using this key attribute you can choose which step receives which part of the extravars. Study the example below to understand how the key property works.
Examples:
1) Resize volume
name:Resize volumetype:multistepsteps:-name:Create datastoretype:awxtemplate:create_datastorekey:datastore# to create the datastore, we only send the datastore info -name:Create vmtype:awxtemplate:create_vmfields:-name:datastoretype:textmodel:datastore.name-name:datastore_sizetype:numbermodel:datastore.size-name:vmtype:textmodel:vm.name-name:vm_sizetype:numbermodel:vm.size# the extravars of the above example will be somewhat like this :datastore:name:ds1size:123vm:name:vm1size:100# Step 1 will not receive the full set of extravars, due to the 'key: datastore' # it will receive only 'name' (ds1) and 'size' (123) (the contents of key 'datastore')# Step 2 has no key set, and will receive the full extravars# Extra : Every step can reference its own key and thus send a piece of the extravars
ifExtraVar extravar reference
Run step if ...
In a mulitstep form, by default, Ansible Forms will try to run every step sequentially one after the other. Using this property you choose if a step should be run or not by setting the property to a part of the extravars that resolves into a boolean (expression or checkbox). This way you can dynamically skip steps.
Examples:
1) Run step based on checkbox
name:Create somethingtype:multistepsteps:-name:Createtype:awxtemplate:create-name:Send emailtype:awxtemplate:send mailifExtraVar:sendmailfields:-name:nametype:textlabel:What to create ?-name:sendmailtype:checkboxlabel:Should I send an email ?
continue boolean
Continue on fail
In a mulitstep form, by default, if 1 step fails, the multistep is stopped. However, if you want to continue to the next step, even if the current step failed, use this attribute and set it to true and the multistep will goto the next step. If this happens the status becomes ‘partially success’.
Default: false
Examples:
1)
name:Resize volumetype:multistepsteps:-name:Send emailtype:awxtemplate:emailcontinue:true# if email send fails, we still continue-name:Resize volumetype:awxtemplate:volume resize
always boolean
Always run
In a mulitstep form, by default, if 1 step fails, the multistep is stopped. However, if you always want to run a certain step, even if a step failed somewhere, use this attribute and set it to true and the specific step will always run.
Default: false
Examples:
1)
name:Resize volumetype:multistepsteps:-name:Load cmdbtype:awxtemplate:load cmdb-name:Resize volumetype:awxtemplate:volume resize-name:Send emailtype:awxtemplate:emailalways:true# whether step 1 or 2 fails, this step always runs
Example
Multi-step forms allow you to break complex workflows into multiple sequential pages, improving user experience and organization. Each step can have its own set of fields and validation.