config.yaml
AnsibleForms uses a config.yaml file for categories and roles configuration. If none is provided, one will be generated with minimum configuration. The config can also be imported into the database, eliminating the need for a config.yaml file.
Overview
The config.yaml file contains the configuration for categories, roles, and constants used by AnsibleForms.
VIDEO: Create your first form
The file below is a minimal sample config.yaml file to start with.
It has only the required default category and the required admin and public roles.
categories: # a list of categories to group forms
- name: Default
icon: bars
roles: # a list of roles
- name: admin
groups:
- local/admins
- name: public
groups: []
options:
allowJobRelaunch: true
constants: {} # free objects to re-use over all forms
Configuration Loading Priority
AnsibleForms loads the config.yaml file in the following order (first match wins):
- FROM DATABASE : If config is imported into the database, it will be used (highest priority)
- FROM REPOSITORY (use_for_config) : Repository with “use for config” switch enabled (new in 6.1.0)
- FROM REPOSITORY (use_for_forms) : Repository with “use for forms” switch enabled (backwards compatibility fallback)
- FROM LOCAL FILE : The local
config.yamlfile (CONFIG_PATH environment variable) - FROM LEGACY FILE : The legacy
forms.yamlfile (FORMS_PATH environment variable)
Note: Only ONE repository should have “use for config” enabled. If multiple are enabled, a warning will be logged and the first one will be used.
Main Attributes
| Attribute | Comments |
|---|---|
| categories array | Categories
The categories group the forms together in a tree-like view. The Default category is mandatory and holds all forms without a category. Added 3.1.0
Added nested categories Examples: 1) Categories |
| roles array | Roles
The roles provide RBAC. Each role has a name and 1 or more groups (local, ldap or azuread). The
When options are not set, the admin role will have all options. The enableLogin option is different, that is for the backend. By default everyone can login. Examples: 1) Roles |
| constants object | Constants
Sometimes you want to have global-like variables. The constants section gives you all freedom. Whether it are objects, arrays, strings, numbers or booleans. They will be available in every form. Examples: 1) Constants |
Category Object
A category groups together 1 or more forms.
| Attribute | Comments |
|---|---|
| name string / required / unique | The name of the category
The name of a category has to be unique. The Default category is mandatory and holds all non-category forms. |
| icon string | Category icon
You can add a nice icon to your categories. The icon name is a free fontawesome 6 icon. You can find more information at www.fontawesome.com. |
| items object added in version 3.1.0 | Sub categories
A category can have sub categories, which is again a category object. |
| Examples | |
| 1) Categories | |
Role Object
A role allows RBAC. Each role has 1 or more groups (local or ldap). Except the public role, which has no groups.
The public and admin roles are mandatory.
| Attribute | Comments |
|---|---|
| name string / required / unique | The name of the role
The name of a role has to be unique. The |
| groups array / required | Groups
A list of groups. They must be in the format of |
| users array / required added in version 4.0.10 | User
A list of local or ldap users. They must be in the format of |
| options object added in version 5.0.8 | Role options
Since version 5.0.8 you can add specific role options. The options are used to enable or disable certain features for a role.
When options are not set, the admin role will have all options. |
| Examples | |
| 1) Roles | |
AnsibleForms loads the config.yaml file in the following order (first match wins):
- FROM DATABASE - If config is imported into the database (highest priority)
- FROM REPOSITORY (use_for_config) - Repository with “use for config” switch enabled
- FROM REPOSITORY (use_for_forms) - Repository with “use for forms” switch enabled (backwards compatibility)
- FROM LOCAL FILE - The local
config.yamlfile (CONFIG_PATH environment variable) - FROM LEGACY FILE - The legacy
forms.yamlfile (FORMS_PATH environment variable)
Only ONE repository should have “use for config” enabled. If multiple are enabled, a warning will be logged and the first one will be used.
Next Steps
- Categories - Learn about organizing forms
- Roles - Set up RBAC
- Constants - Define global variables