Skip to content

Commit

Permalink
Added an example credential with HashiCorp Vault source (#909)
Browse files Browse the repository at this point in the history
* Added an example credential with HashiCorp Vault source

* Added additional information on source_credential and metadata fields

* Added HashiCorp Vault example to credentials README
  • Loading branch information
ryangniadek authored Sep 19, 2024
1 parent 3715b13 commit b27aa85
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 2 deletions.
27 changes: 25 additions & 2 deletions roles/credential_input_sources/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,12 @@ This also speeds up the overall role.
|:---:|:---:|:---:|:---:|:---:|
|`target_credential`|""|yes|str|Name of credential to have the input source applied|
|`input_field_name`|""|yes|str|Name of field which will be written by the input source|
|`source_credential`|""|no|str|Name of the source credential which points to a credential source|
|`source_credential`|""|no|str|Name of the source credential which points to an external secret lookup credential |
|`metadata`|""|no|dict|The metadata applied to the source.|
|`description`|""|no|str|Description to use for the credential input source.|
|`state`|`present`|no|str|Desired state of the resource.|

For further details on fields see <https://docs.ansible.com/automation-controller/latest/html/userguide/credential_plugins.html>
For further details on fields see <https://docs.ansible.com/automation-controller/latest/html/userguide/credential_plugins.html>. The input accepted by the `metadata` field will differ depending on the credential plugin being used.

### Standard Credential Input Source Data Structure

Expand All @@ -101,6 +101,19 @@ For further details on fields see <https://docs.ansible.com/automation-controlle
"object_query_format": "Exact"
},
"description": "Fill the gitlab credential from CyberArk"
},
{
"source_credential": "hashivault",
"target_credential": "gitlab",
"input_field_name": "password",
"metadata": {
"secret_backend": "mykv",
"secret_path": "vault/path/to/gitlab/secret",
"auth_path": "approle",
"secret_key": "GITLAB_PASSWORD_FROM_HASHI_VAULT",
"secret_version": "v2"
},
"description": "Fill the gitlab credential from HashiCorp Vault"
}
]
}
Expand All @@ -111,6 +124,16 @@ For further details on fields see <https://docs.ansible.com/automation-controlle
```yaml
---
controller_credential_input_sources:
- source_credential: hashivault
target_credential: gitlab
input_field_name: password
metadata:
secret_backend: mykv
secret_path: vault/path/to/gitlab/secret
auth_path: approle
secret_key: GITLAB_PASSWORD_FROM_HASHI_VAULT
secret_version
description: Fill the gitlab credential from HashiCorp Vault
- source_credential: cyberark
target_credential: gitlab
input_field_name: password
Expand Down
9 changes: 9 additions & 0 deletions roles/credentials/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,15 @@ controller_credentials:
inputs:
username: person
password: password
- name: hashivault
description: HashiCorp Vault Secret Lookup example using token auth
organization: Default
credential_type: HashiCorp Vault Secret Lookup
inputs:
url: https://vault.example.com:8243
token: token
cacert: "{{ lookup('ansible.builtin.file', '/path/to/ca-certificates.crt') }}"
api_version: v2
- name: localuser
description: Machine Credential example with become_method input
credential_type: Machine
Expand Down

0 comments on commit b27aa85

Please sign in to comment.