Create custom credentials for Event-Driven Ansible
Create custom credential types (via JSON/YAML) to define unique security fields and logic, enabling support for proprietary event sources or specialized authentication.
Each credential type displays its own unique configurations in the Input Configuration and the Injector Configuration fields, if applicable. Both YAML and JSON formats are supported in the configuration fields.
Custom credentials support Ansible extra variables as a means of injecting their authentication information.
You can attach one or more cloud, vault, and Red Hat Ansible Automation Platform credential types to a rulebook activation.
- When creating a new credential type, you must avoid collisions in the
extra_vars. - Extra variable names must not start with EDA_ because they are reserved.
- You must have System administrator (superuser) permissions to be able to create and edit a credential type and to be able to view the Injector configuration field.
When you customize your own credential types, they display on the Credential Types page along with a list of built-in credential types.
Input configuration Copy linkLink copied!
You can configure the input fields and define which parameters are required when a user creates a credential of this custom type.
The Input configuration has two attributes:
- fields - a collection of properties for a credential type.
- required - a list of required fields.
Fields can have multiple properties, depending on the credential type you select.
| Fields | Description | Mandatory (Y/N) |
|---|---|---|
| id |
Unique id of the field; must be a string type and stores the variable name |
Yes |
| type |
Can be string or boolean type |
No, default is string |
| label |
Used by the UI when rendering the UI element |
Yes |
| secret |
Will be encrypted |
No, default false |
| multiline |
If the field contains data from a file the multiline can be set to True |
No, default false |
| help_text |
The help text associated with this field |
No |
Injector configuration Copy linkLink copied!
You can use Injector configuration to safely transform and map credential data from input fields so that it can be correctly exposed and consumed by ansible-rulebook at runtime.
Event-Driven Ansible supports the following types of injectors:
- Environment variables (
env) - Used in source plugins for the underlying package or shared library. - Ansible extra variables (
extra_vars) - Used for substitution in the rulebook conditions, actions or source plugin parameters. - File-based templating (
file) - Used to create file contents from the credential inputs such as certificates and keys, which might be required by source plugins. File injectors provide a way to deliver these certificates and keys to ansible-rulebook at runtime without having to store them in decision environments. As a result, ansible-rulebook creates temporary files and the file names can be accessed usingeda.filenamevariables, which are automatically created for you after the files have been created (for instance, "{{eda.filename.my_cert}}”).
When creating extra_vars in rulebook activations and credential type injectors, avoid using eda or ansible as key names since that conflicts with internal usage and might cause failure in both rulebook activations and credential type creation.
Injectors enable you to adjust the fields so that they can be injected into a rulebook as one of the above-mentioned injector types, which cannot have duplicate keys at the top level. If you have two sources in a rulebook that both require parameters such as username and password, the injectors, along with the rulebook, help you adapt the arguments for each source.
Creating a new credential type Copy linkLink copied!
Define a custom credential type by using a YAML or JSON schema. Defining these custom types helps ensure that authentication information is securely injected into automation workflows.
Procedure Copy linkLink copied!
Results Copy linkLink copied!
- Verify that the newly created credential type can be selected from the Credential Type selection window when creating a new credential: