Skip to main content

Addons for opentaskpy, giving it the ability to read variables from Hashicorp Vault

Project description

PyPi unittest status Coverage License Issues Stars

This repository contains a variable lookup plugins for Open Task Framework (OTF) to pull dynamic variables from HashiCorp Vault.

Open Task Framework (OTF) is a Python based framework to make it easy to run predefined file transfers and scripts/commands on remote machines.

Vault Variables

This package uses hvac to communicate with Vault.

Credentials can be set via config using specific named variables alongside the protocol definition, or by using environment variables e.g;

"protocol": {
    "name": "local",
    "VAULT_ADDR": "https://vault.example.com:8200",
    "VAULT_TOKEN": "some_token"
}

If these variables are set in the environment, then these will be used if not set elsewhere.

Vault KV Secrets Engine Version

The default version is v1. This can be overridden by setting the environment variable VAULT_API_VER to v2 (or specifying the variable manually)

Variable Lookup

Variables can be looked up using the vault plugin. This is done using standard Jinja2 syntax e.g;

{
  "name": "my_task",
  "variables": {
    "my_variable": "{{ vault('secret/data/my_secret', key='my_key') }}"
  }
}

If not supplied using the attribute argument, the default key is value. If the key does not exist, the plugin will return an error.

{
  "name": "my_task",
  "variables": {
    "my_variable": "{{ vault('secret/data/my_secret', key='some_key', attribute='password') }}"
  }
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

otf_addons_vault-24.18.3.tar.gz (23.0 kB view details)

Uploaded Source

File details

Details for the file otf_addons_vault-24.18.3.tar.gz.

File metadata

  • Download URL: otf_addons_vault-24.18.3.tar.gz
  • Upload date:
  • Size: 23.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.4

File hashes

Hashes for otf_addons_vault-24.18.3.tar.gz
Algorithm Hash digest
SHA256 43f4754f84963322cb2c964b9f32549066fe110621175463cbd952f2930ade3c
MD5 12f90a3b9aacd45b730616589126b883
BLAKE2b-256 e268356c1126f33420390fca22a8611dea722fe27d09aa36f558fdef469279d1

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page