Ansible Forms
Ansible forms execute a local Ansible Core playbook when submitted.
Targets an Ansible Core playbook.
Ansible Core Form
forms:
- name: Create a vm
roles: # reference to roles defined earlier
- vmware
description: Create a virtual machine
help: |
This Form creates a virtual machine. it will connect to `vcenter`. This help is Markdown
so you can use **markdown** markup to highlight __certain words__.
showHelp: true # show help on load
icon: computer # a font awesome icon
categories: # reference to categories defined earlier
- Demo
- Vmware/Linux # Add to a subcategory using the `/` separator
tileClass: bg-success-subtle # a bootstrap background color style (https://getbootstrap.com/)
playbook: playbook_vm.yml # playbook to launch (only if type = ansible)
inventory: inventory.yml # optional ansible inventory file
check: false # run in checkmode or not
diff: false # show differences
verbose: false # verbose output
keepExtravars: false # keep extravars json file
tags: vm,create # optional ansible tags (comma separated)
type: ansible # type is awx or ansible
onSubmit: # event handler on form submit
- clear: 0 # clear form after 0 seconds
- hide: 1 # hide form after 1 second
onFinish: # event handler on job finished
- show: 2 # show the form after 2 seconds
fieldGroupClasses: # give fieldgroups a custom background
groupname1: bg-info-subtle
groupname2: bg-success-subtle
fields: # list of field objects Properties
Properties specific to type: ansible, in addition to the common form properties.
Basic
| Attribute | Comments |
|---|---|
| roles array / required | Who has access You can have RBAC by adding roles to a form. If you want everyone to see the form, add the Examples: 1) Give access to vmware team |
| categories array | Categories By adding one or more categories, you can group forms together in categories. Examples: 1) Category vmware |
| playbook string | Ansible playbook This attribute is only used when the form type is Note : You can also dynamically set the playbook by using a field called Examples: 1) Run foobar playbook 2) Use dynamic playbook name |
| credentials object added in version 4.0.16 | Send credentials to your playbook/template From the earlier versions, you could send credentials, stored in Ansible Forms, by using the field-property Examples: 1) Send vmware and microsoft credentials 2) Dynamically send credentials |
| ansibleCredentials string added in version 4.0.17 | Pass ansible_user and ansible_password to ansible playbook using stored credentials Ansible allows to pass default ansible credentials in the form of 2 extravars ansible_user and ansible_password |
| playbookSubPath string added in version 6.0.1 | Subfolder structure for playbooks If you have a more complex ansible setup, you might want to organize them in subfolders. Use this property to define a subfolder (or multiple levels) where you want to launch ansible-playbook from. |
| vaultCredentials string added in version 5.0.2 | Pass vault password to ansible playbook using stored credentials Ansible can encrypt variables in a vault, to unlock the vault a password is needed. This password can be stored in Ansible Forms (as credential) and passed to the playbook.. |
| varsFiles array added in version 6.1.0 | Load YAML files as constants Load one or more YAML files as constants that will be merged with the base config constants. Files must contain a dictionary (not a list) and must have .yml or .yaml extension. Path Resolution:
Use Cases:
Note: Files are merged in order. Later files override earlier ones if keys conflict. Variables from varsFiles are merged with base config constants. Examples: 1) Load single vars file 2) Load multiple vars files with absolute paths 3) Mix relative and absolute paths |
Interaction
| Attribute | Comments |
|---|---|
| approval object | Add approval point Ansible Forms allows to add an approval point before a job is ran. |
| notifications object | Add Notification Add email notifications on job status events. Examples: 1) Send on success |
| onSubmit array added in version 3.1.0 | Events on submit Once a job is launched, Ansible Forms has a few status events you can act on.
Follow the link above to learn about the possible job status actions Examples: 1) Examples |
| onSuccess array added in version 3.1.0 | Events on success Once a job is launched, Ansible Forms has a few status events you can act on.
Follow the link above to learn about the possible job status actions Examples: 1) Examples |
| onFailure array added in version 3.1.0 | Events on failure Once a job is launched, Ansible Forms has a few status events you can act on.
Follow the link above to learn about the possible job status actions Examples: 1) Examples |
| onAbort array added in version 3.1.0 | Events on abort Once a job is launched, Ansible Forms has a few status events you can act on.
Follow the link above to learn about the possible job status actions Examples: 1) Examples |
| onFinish array added in version 3.1.0 | Events on finished Once a job is launched, Ansible Forms has a few status events you can act on.
Follow the link above to learn about the possible job status actions Examples: 1) Examples |
Visualization
| Attribute | Comments |
|---|---|
| showHelp boolean | Show Help Show the help by default or collapse the help. Default: true |
| icon string | Form icon You can add a nice icon to your forms. The icon name is a free fontawesome 6 icon. You can find more information at www.fontawesome.com. Examples: 1) Trash icon |
| iconColor string | Icon color Specifies the color of the icon. Use any valid CSS color class name (e.g., primary, success, danger, warning, info, dark, white, …). Examples: 1) Red icon |
| iconSize string | Icon size Specifies the size of the icon. Default: 3x Examples: 1) Large icon |
| overlayIcon string | Overlay icon on main icon Adds a icon on top of the main icon for layering effects. Useful for status indicators or badges. Examples: 1) Server with check overlay |
| overlayIconTransform string | Transform for overlay icon Specifies the transform/positioning for the overlay icon. You can use FontAwesome transform values like shrink, grow, up, down, left, right. Default: shrink-6 up-7 right-7 Examples: 1) Custom positioned overlay |
| overlayIconColor string | Color for overlay icon Specifies the color of the overlay icon. Default: success Examples: 1) Red overlay icon |
| overlayIconCircle boolean | Show circle background behind overlay icon When enabled, shows a colored circle background behind the overlay icon. The circle uses the overlayIconColor, and the icon inside becomes white in light mode or dark in dark mode. When disabled, the overlay icon appears without a circle background. Default: true Examples: 1) Overlay without circle |
| overlayIconText string | Text overlay on icon Adds text as an overlay on the icon. Can be used for badges, counters, or labels. Examples: 1) New badge |
| overlayIconTextPosition string | Position for text overlay Specifies the position of the text overlay. Default: bottom-left Examples: 1) Top right badge |
| overlayIconTextColor string | Color for text overlay Specifies the color of the text overlay. Default: success Examples: 1) Warning badge |
| image string | Form image You can add a nice image to your form. You can provide a local or remote url. But if you are in a secured location, you might want to go for a base64 encode image. This allows you to embed the image in the yaml file. Examples: 1) Microsoft image 2) Internet image 3) Local image |
| tileClass string | Form tile background colour Ansible Forms uses the Bootstrap css framework to style the webapplication. Default: bg-info-subtle Examples: 1) warning color 2) success light color |
| fieldGroupClasses object | Fieldgroup background color Ansible Forms uses the Bootstrap css framework to style the webapplication. Bootstrap has a few color helper classes you can use to give your fieldgroups a background color. You can find them here background color and foreground color. Examples: 1) Color fieldgroup |
| order integer added in version 5.1.0 | Order of the form in the list The order of the form in the list of forms. Forms are sorted by this order, so you can have a specific order in the list. Note : If you do not set this property, it will be ordered alphabetically by name. |
Workflow
| Attribute | Comments |
|---|---|
| inventory string | Inventory 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 |
| 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 |
| limit text | Run against a limited number of hosts In awx and ansible core you run a playbook against limited hosts by supplying a host pattern. Use this attribute to do so. Note : You can also dynamically set the limit by using a field called |
| 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 |
| verbose boolean added in version 4.0.0 | Run in verbose mode In ansible core you run a playbook in verbose mode. Enable this attribute to do so. Note : You can also dynamically set the verbose mode by using a field called |
| keepExtravars boolean added in version 4.0.0 | Do not remove the extarvars json file In ansible core we temporarily store the extravars in a json file. After run, this file is removed. Use this property to disable this behaviour. Note : You can also dynamically set this property by using a field called |
| abortable boolean added in version 5.0.8 | Allow aborting the job By default you can allow the user to abort the job. Use this attribute to disable this behaviour. Default: true |
| string | Set tags 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 |