Ansible Forms
Forms that run a local Ansible playbook
Targets an Ansible playbook, run on a runner of type rte (Connections > Runners), named with runner: or the default one. Since 7 AnsibleForms runs no playbook itself.
Ansible Core Form
- 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
allowJinjaInExtravars: false # let ansible template jinja in values
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
- name: vm_name
type: textThe repository a playbook runs from
Since 7.8.0 a form may name the repository its playbook runs from, with playbookRepository.
Without it, the playbook runs from the first repository used for playbooks, from its playbooks folder (else its root), as before. With it, the playbook runs from the root of the repository named, so that repository’s ansible.cfg, roles/ and relative inventory paths apply, and playbook is given from the root (playbooks/site.yml). The layout and a full example are in A repository in Ansible’s own layout.
playbookRepository: __self__ names the repository the form itself is read from, so a form kept with its playbook never names its repository. A form in no repository (the local forms folder) cannot use it: its launch is refused. See The repository the form is in.
Since 7.8.0 the playbook receives the name of the form that started it as the extravar __formname__, so a playbook shared by several forms can tell which one it was launched from. It is reserved: no field of a form may take that name.
Its runtime environment
Since 7.9.0 an ansible form may name the image its jobs run in, with executionEnvironment (Runtime environment in the Designer).
It takes one of these names, which the Designer’s dropdown offers:
| Name | The image |
|---|---|
rte-full, rte-core | The published RTE image of the app’s major release, ghcr.io/ansibleforms/ansibleforms-rte-full:7 |
| A runtime environment of the Designer | The image of its latest successful build, pulled from its registry with that registry’s login |
name: Create a volume
type: ansible
playbook: netapp/create-volume.yml
runner: zone-a
executionEnvironment: rte-netapp
It needs a runner that runs each job in a container of its own, the RTE Runner written in Go. A Node RTE runs every job in its own image: a job that names an image there fails, saying so, and under the field the Designer warns Runner <name> runs every job in its own image: name a runner written in Go. A name that is no image a job may run in, such as a runtime environment never built, fails the job too.
Without it, the job runs in the runner’s Default image, set on the RTE tab of its page, else in the Runner’s own RTE_IMAGE. The job’s page shows the image it ran in, as Image. A field named __executionEnvironment__ sets it at launch, and an ansible step of a multistep form may name its own.
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 Name it by its file with its subfolders in the playbook folder ( 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 AnsibleForms, 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 Note: An SSH credential can carry a private key (PEM or OpenSSH) instead of, or next to, its password. The runner writes the key to a private file for that job only and passes it as |
| 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. |
| playbookRepository string added in version 7.8.0 | The repository the playbook runs from The repository whose playbook the form runs, one with the Playbooks usage. The playbook then runs from that repository’s root: its Examples: 1) A repository in Ansible's own layout 2) The repository the form is in |
| 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 AnsibleForms (as credential) and passed to the playbook.. |
| wizard array added in version 6.4.0 | Wizard steps (form-layer) Turn a form into a multi-page wizard. Examples: 1) Three-step wizard 2) Wizard mapped one-to-one onto multistep (defaultModel + key) |
| 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 AnsibleForms allows to add an approval point before a job is ran. |
| notifications object | Add Notification Add notifications on job status events: by email ( Examples: 1) Send on success 2) Post to Slack and Teams when it fails |
| onSubmit array added in version 3.1.0 | Events on submit Once a job is launched, AnsibleForms 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, AnsibleForms 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, AnsibleForms 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, AnsibleForms 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, AnsibleForms 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 AnsibleForms 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 AnsibleForms 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. Ansible: the name of an inventory of the designer’s Inventories section ( Note: You can also dynamically set the inventory by using a field called Examples: 1) Run against an inventory of the designer |
| executionEnvironment string added in version 5.0.0 | Execution Environment An ansible form : the image its jobs run in, by its name: An AWX, AAP or Ascender form : in newer versions of AWX you can choose an execution environment. Use this property to pass it to your template. Note: You can also dynamically set the executionEnvironment by using a field called Examples: 1) An ansible form run in an image of the Designer |
| runner string added in version 7.0.0 | Where the job runs The runner that runs this form’s job, of the type the form’s type asks for: rte (a runtime environment container) for A disabled runner (its Enabled switch off) fails the job, also when it is the default: there is no fallback to another runner. A role’s Semaphore: a form of type semaphore runs the Semaphore template named by Rundeck: a form of type rundeck runs the Rundeck job named by Jenkins: a form of type jenkins builds the Jenkins job named by Examples: 1) Run on the vmware runtime 2) Run a template on a named AAP 3) Run a Semaphore template 4) Run a Rundeck job 5) Build a Jenkins job |
| 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 string | 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 |
| allowJinjaInExtravars boolean added in version 7.0.1 | Let ansible template Jinja in the form's values A value that contains Jinja ( Set this to Note: You can also dynamically set this property by using a field called |
| userExtravars string | Which keys of the user go into the extravars Overrides the Leave it out and the form follows the global setting. Note: a multistep applies the form’s value to every step, including the partial extravars a step receives through |
| 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 |
| allowRelaunch boolean added in version 6.2.0 | Allow relaunching the job By default, users with the Default: true Examples: 1) Prevent relaunching a form |
| allowStoredJobSharing boolean added in version 7.5.0 | Allow sharing stored jobs By default, a user with the Default: true Examples: 1) Keep the stored jobs of a form private |
| launchValidation string added in version 6.4.1 | Check every launch of this form on the server Checks every launch of this form on the server against its validation rules, with the same engine the browser and the MCP server use - see the Set it on a form that is launched over the REST API: with Mind the fields the server computes again: a timestamp ( The stricter of this property and A wizard form is checked step by step: every step the browser submits is resolved against its subform. See the Launch validation page of the documentation. Default: the LAUNCH_VALIDATION environment variable Examples: 1) A form that is launched over REST |
| enableForChat boolean added in version 6.5.0 | Offer this form in the chat assistant The chat assistant ( The assistant fills the form in with the user, through the same form engine as the browser, and never launches it: the user clicks Launch on the exact payload the chat showed. A wizard form is filled in step by step, as the browser walks it; an optional step the user gives no answer for is skipped. Default: false Examples: 1) A form the chat may offer |
| 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 |