11# DVLS Ansible Module
22
3- This Ansible module allows you to authenticate with DVLS and fetch secrets by name or ID .
3+ This Ansible module allows you to authenticate with DVLS and fetch server information, vaults, and secrets .
44
5- ## Requirements
5+ ## Features
6+ - Authenticate with DVLS using application identities.
7+ - Fetch server information, vault lists, or specific secrets.
8+ - Flexible support for static secrets or fetching all secrets in a vault.
69
10+ ## Requirements
711- Ansible
8- - Python requests library
9- - You must have a DVLS application identities, it can be created at {your-dvls-url}/administration/applications
10- - This application must have permission to fetch the desired secrets
11- - Set the necessary environment variables for DVLS authentication:
12+ - Python ` requests ` library
13+ - A DVLS application identity (create at ` {your-dvls-url}/administration/applications ` ).
14+ - The application must have permissions to fetch the desired secrets.
1215
16+ Set the following environment variables for DVLS authentication:
1317``` sh
1418export DVLS_APP_KEY=" your_app_key_here"
1519export DVLS_APP_SECRET=" your_app_secret_here"
1620```
1721
18- ## Usage
22+ ## Usage with static secrets file
1923
2024### Example secrets.yml
2125Define the secrets you want to fetch in ``` secrets.yml ``` :
@@ -31,15 +35,12 @@ secrets:
3135Use the following playbook to authenticate with DVLS and fetch the secrets defined in ` ` ` secrets.yml```:
3236
3337` ` ` yaml
34- ---
35- - name: Fetch secrets from DVLS
36- hosts: localhost
3738 vars_files:
3839 - secrets.yml
3940 tasks:
4041 - name: Fetch secrets
4142 devolutions.dvls.fetch_secrets:
42- server_base_url: "https://example.yourcompagny .com"
43+ server_base_url: "https://example.yourcompany .com"
4344 app_key: "{{ lookup('env', 'DVLS_APP_KEY') }}"
4445 app_secret: "{{ lookup('env', 'DVLS_APP_SECRET') }}"
4546 vault_id: "00000000-0000-0000-0000-000000000000"
@@ -55,41 +56,91 @@ Use the following playbook to authenticate with DVLS and fetch the secrets defin
5556 msg: "{{ secrets['name-or-id'].value }}"
5657` ` `
5758
58- To access a particular field within a secret, you can use the format ```{{ secrets['name-or-id'].value }}```. Here’s a breakdown of the available categories and their fields :
59+ # # Usage fetching all secrets
60+
61+ # ## Example playbook.yml using a VaultID
62+ Use the following playbook to authenticate with DVLS and fetch every secrets from a defined VaultID :
63+
64+ ` ` ` yaml
65+ tasks:
66+ - name: Fetch secrets
67+ devolutions.dvls.fetch_secrets:
68+ server_base_url: "https://example.yourcompany.com"
69+ app_key: "{{ lookup('env', 'DVLS_APP_KEY') }}"
70+ app_secret: "{{ lookup('env', 'DVLS_APP_SECRET') }}"
71+ vault_id: "00000000-0000-0000-0000-000000000000"
72+ register: secrets
73+
74+ - name: Dump secrets
75+ debug:
76+ msg: "{{ secrets }}"
77+
78+ - name: Dump a secret
79+ debug:
80+ msg: "{{ secrets['name-or-id'].value }}"
81+ ` ` `
82+
83+ # # Usage fetching server info and vaults list
84+
85+ ` ` ` yaml
86+ ---
87+ - name: Fetch dvls server information
88+ server:
89+ server_base_url: "https://example.yourcompany.com"
90+ app_key: "{{ lookup('env', 'DVLS_APP_KEY') }}"
91+ app_secret: "{{ lookup('env', 'DVLS_APP_SECRET') }}"
92+ register: server
93+
94+ - name: Fetch URI
95+ debug:
96+ msg: "{{ server.accessURI }}"
97+
98+ - name: Fetch a vault from the list
99+ debug:
100+ msg: "{{ server.vaults[1].id }}"
101+ ` ` `
102+
103+ Example response
59104
60105` ` ` json
61- "Username and password": {
62- "domain": "",
63- "password": "",
64- "username": ""
65- },
66- "Connection string": {
67- "connectionString": ""
68- },
69- "Secret": {
70- "password": ""
71- },
72- "API key": {
73- "apiId": "",
74- "apiKey": "",
75- "tenantId": ""
76- },
77- "SSH key": {
78- "domain": "",
79- "password": "",
80- "privateKeyData": "",
81- "privateKeyOverridePassword": "",
82- "privateKeyPassPhrase": "",
83- "publicKeyData": "",
84- "username": ""
85- },
86- "Azure service principal": {
87- "clientId": "",
88- "clientSecret": "",
89- "tenantId": ""
90- },
106+ {
107+ "server": {
108+ "accessURI": "https://example.dvls-server.com/",
109+ "changed": false,
110+ "expirationDate": "2030-12-31T23:59:59",
111+ "failed": false,
112+ "vaults": [
113+ {
114+ "description": "User vault for personal entries",
115+ "id": "123e4567-e89b-12d3-a456-426614174000",
116+ "type": "User"
117+ },
118+ {
119+ "description": "Shared vault for organization",
120+ "id": "987f6543-d21c-43ba-987f-123456789abc",
121+ "name": "Organization vault",
122+ "type": "Shared"
123+ }
124+ ],
125+ "version": "2025.1.0.0"
126+ }
127+ }
91128` ` `
92129
130+ # # Secrets definition
131+
132+ To access a particular field within a secret, you can use the format ```{{ secrets['name-or-id'].value }}```. Here’s a breakdown of the available categories and their fields :
133+
134+ | **Category** | **Fields** |
135+ |---------------------------|---------------------------------------------------------------------------|
136+ | Username and password | `domain`, `password`, `username` |
137+ | Connection string | `connectionString` |
138+ | Secret | `password` |
139+ | API key | `apiId`, `apiKey`, `tenantId` |
140+ | SSH key | `domain`, `password`, `privateKeyData`, `privateKeyOverridePassword`, `privateKeyPassPhrase`, `publicKeyData`, `username` |
141+ | Azure service principal | `clientId`, `clientSecret`, `tenantId` |
142+
143+
93144# ## Example using secret value
94145For example, if you want to access the ```apiId``` from an ```API key secret```, you would use the following syntax :
95146
0 commit comments