Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 39 additions & 5 deletions .github/workflows/galaxy_publish.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,61 @@
name: Publish to Ansible Galaxy

on:
release:
types: published
workflow_dispatch:

jobs:
publish:
environment: publish
runs-on: ubuntu-latest
outputs:
version: ${{ steps.build.outputs.version }}

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Build
run: ansible-galaxy collection build
id: build
run: |
OUTPUT=$(ansible-galaxy collection build)
echo "$OUTPUT"
COLLECTION_PATH=$(echo "$OUTPUT" | grep -o '/[^ ]*\.tar\.gz')
VERSION=$(echo "$COLLECTION_PATH" | grep -o -E '[0-9]+\.[0-9]+\.[0-9]+\.tar\.gz' | sed 's/\.tar\.gz//')
echo "collection_path=$COLLECTION_PATH" >> $GITHUB_OUTPUT
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "Collection path: $COLLECTION_PATH"
echo "Collection version: $VERSION"

- name: Publish to Ansible Galaxy
run: ansible-galaxy collection publish *.tar.gz --api-key ${{ secrets.ANSIBLE_GALAXY_TOKEN }}
run: ansible-galaxy collection publish ${{ steps.build.outputs.collection_path }} --api-key ${{ secrets.ANSIBLE_GALAXY_TOKEN }}

- name: Upload Artifact
uses: actions/upload-artifact@v4.3.6
with:
name: ansible-dvls-collection
path: '*.tar.gz'
path: ${{ steps.build.outputs.collection_path }}

create-release:
name: Create release
runs-on: ubuntu-latest
needs: publish

steps:
- name: Check out ${{ github.repository }}
uses: actions/checkout@v4
with:
fetch-depth: 0 # fetch all tags for the set version step

- name: Check out Devolutions/actions
uses: actions/checkout@v4
with:
repository: Devolutions/actions
ref: v1
token: ${{ secrets.DEVOLUTIONSBOT_TOKEN }}
path: ./.github/workflows

- name: Create release
uses: ./.github/workflows/create-release
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
tag: v${{ needs.publish.outputs.version }}
20 changes: 9 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,15 @@ Use the following playbook to authenticate with DVLS and fetch the secrets defin
app_secret: "{{ lookup('env', 'DVLS_APP_SECRET') }}"
vault_id: "00000000-0000-0000-0000-000000000000"
secrets: "{{ secrets }}"
register: secrets
register: value

- name: Dump secrets
debug:
msg: "{{ secrets }}"
msg: "{{ value }}"

- name: Dump a secret
debug:
msg: "{{ secrets['name-or-id'].value }}"
msg: "{{ value['name-or-id'].value }}"
```

## Usage fetching all secrets
Expand All @@ -69,15 +69,15 @@ Use the following playbook to authenticate with DVLS and fetch every secrets fro
app_key: "{{ lookup('env', 'DVLS_APP_KEY') }}"
app_secret: "{{ lookup('env', 'DVLS_APP_SECRET') }}"
vault_id: "00000000-0000-0000-0000-000000000000"
register: secrets
register: value

- name: Dump secrets
debug:
msg: "{{ secrets }}"
msg: "{{ value }}"

- name: Dump a secret
debug:
msg: "{{ secrets['name-or-id'].value }}"
msg: "{{ value['name-or-id'].value }}"
```

## Usage fetching server info and vaults list
Expand All @@ -89,15 +89,15 @@ Use the following playbook to authenticate with DVLS and fetch every secrets fro
server_base_url: "https://example.yourcompany.com"
app_key: "{{ lookup('env', 'DVLS_APP_KEY') }}"
app_secret: "{{ lookup('env', 'DVLS_APP_SECRET') }}"
register: server
register: value

- name: Fetch URI
debug:
msg: "{{ server.accessURI }}"
msg: "{{ value.accessURI }}"

- name: Fetch a vault from the list
debug:
msg: "{{ server.vaults[1].id }}"
msg: "{{ value.vaults[1].id }}"
```

Example response
Expand Down Expand Up @@ -163,7 +163,6 @@ When a new secret was created or updated, the module will return the entry ID.
secret:
secret_name: "my_secret_1"
value: "p@ssw0rd1"
register: secrets
```

Example with additional available options (Currently only the "Credential" type and "Default" subtype are supported):
Expand All @@ -182,5 +181,4 @@ Example with additional available options (Currently only the "Credential" type
secret_type: "Credentials"
secret_subtype: "Default"
secret_description: "a description for the secret"
register: secrets
```
11 changes: 7 additions & 4 deletions galaxy.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
namespace: devolutions
name: dvls
version: 1.1.1
version: 1.2.1
readme: README.md
authors:
- Danny Bédard <devops@devolutions.net>
description: This Ansible module allows you to authenticate with DVLS and fetch server information, vaults and secrets by name or ID.
license: MIT
license_file: ''
description: >
Ansible collection for interacting with Devolutions Server (DVLS). It provides modules for authentication,
retrieving server information and vaults, and performing create, read and update operations on secrets.
Enables automation of common Devolutions Password Server tasks within Ansible workflows.
license:
- MIT
tags: [dvls, secrets, devolutions, password]
dependencies: {}
repository: https://github.com/Devolutions/ansible-dvls
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/secrets.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
secrets:
- secret_name: "secret"
- secret_id: "890cbb54-7078-4d0c-925f-e89a33ee3e46"
- secret_id: "717ff96a-d835-4ac5-9cdd-3a2a0a93fe7f"
4 changes: 2 additions & 2 deletions tests/integration/test_get_secret.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
app_secret: "{{ lookup('env', 'DVLS_APP_SECRET') }}"
vault_id: "{{ lookup('env', 'DVLS_VAULT_ID') }}"
secrets:
- secret_id: 08a6526d-1f86-40e2-aef1-a74cc31a548d
- secret_id: 717ff96a-d835-4ac5-9cdd-3a2a0a93fe7f

- name: Get secret from name
devolutions.dvls.fetch_secrets:
Expand All @@ -35,7 +35,7 @@
app_secret: "{{ lookup('env', 'DVLS_APP_SECRET') }}"
vault_id: "{{ lookup('env', 'DVLS_VAULT_ID') }}"
secrets:
- secret_name: AzureSP
- secret_name: secret

- name: Get secret from Folder
devolutions.dvls.fetch_secrets:
Expand Down