Metadata-Version: 2.1
Name: otf-addons-vault
Version: 24.18.1
Summary: Addons for opentaskpy, giving it the ability to read variables from Hashicorp Vault
Author-email: Adam McDonagh <adam@elitemonkey.net>
License: GPLv3
Project-URL: Homepage, https://github.com/adammcdonagh/otf-addons-vault
Project-URL: Bug Tracker, https://github.com/adammcdonagh/otf-addons-vault/issues
Project-URL: Changelog, https://github.com/adammcdonagh/otf-addons-vault/blob/main/CHANGELOG.md
Keywords: automation,task,framework,hashicorp,vault,secrets,otf
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
Classifier: Operating System :: POSIX
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
License-File: AUTHORS
Requires-Dist: hvac>=2.2.0
Requires-Dist: opentaskpy>=v24.18.0
Provides-Extra: dev
Requires-Dist: pytest-shell; extra == "dev"
Requires-Dist: types-requests; extra == "dev"
Requires-Dist: types-python-dateutil; extra == "dev"
Requires-Dist: black>=24.1.1; extra == "dev"
Requires-Dist: isort; extra == "dev"
Requires-Dist: pytest; extra == "dev"
Requires-Dist: bumpver; extra == "dev"
Requires-Dist: pytest-shell; extra == "dev"
Requires-Dist: lovely-pytest-docker; extra == "dev"
Requires-Dist: pre-commit; extra == "dev"
Requires-Dist: pylint; extra == "dev"
Requires-Dist: pydantic; extra == "dev"
Requires-Dist: mypy; extra == "dev"
Requires-Dist: ruff; extra == "dev"
Requires-Dist: coverage; extra == "dev"
Requires-Dist: pytest-cov; extra == "dev"
Requires-Dist: hvac; extra == "dev"

[![PyPi](https://img.shields.io/pypi/v/otf-addons-vault.svg)](https://pypi.org/project/otf-addons-vault/)
![unittest status](https://github.com/adammcdonagh/otf-addons-vault/actions/workflows/test.yml/badge.svg)
[![Coverage](https://img.shields.io/codecov/c/github/adammcdonagh/otf-addons-vault.svg)](https://codecov.io/gh/adammcdonagh/otf-addons-vault)
[![License](https://img.shields.io/github/license/adammcdonagh/otf-addons-vault.svg)](https://github.com/adammcdonagh/otf-addons-vault/blob/master/LICENSE)
[![Issues](https://img.shields.io/github/issues/adammcdonagh/otf-addons-vault.svg)](https://github.com/adammcdonagh/otf-addons-vault/issues)
[![Stars](https://img.shields.io/github/stars/adammcdonagh/otf-addons-vault.svg)](https://github.com/adammcdonagh/otf-addons-vault/stargazers)

This repository contains a variable lookup plugins for [Open Task Framework (OTF)](https://github.com/adammcdonagh/open-task-framework) 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;

```json
"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.

# Variable Lookup

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

```json
{
  "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.

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