Skip to content

feat: allow additional environment variables #366

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
3 changes: 3 additions & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,9 @@ vault_listener_localhost_enable: false
vault_http_proxy: ""
vault_https_proxy: ""
vault_no_proxy: ""
vault_additional_environment_variables: {}
# FOO: bar
# FOO2: bar2

# ---------------------------------------------------------------------------
# TCP listeners
Expand Down
12 changes: 12 additions & 0 deletions role_variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -816,6 +816,18 @@ available starting at Vault version 1.4.
- Comma separated values which specify hosts that should be exluded from proxying. Follows [golang conventions](https://godoc.org/golang.org/x/net/http/httpproxy)
- Default value: `""`

## `vault_additional_environment_variables`

- Dict of items of type `Dict[str, str]` to add additional environment variables to the systemd service
- Default value: `{}`

Example:

```yaml
vault_additional_environment_variables:
FOO: bar
```

## `vault_cluster_address`

- Address to bind to for cluster server-to-server requests
Expand Down
3 changes: 3 additions & 0 deletions templates/vault_service_systemd.j2
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ Environment=HTTPS_PROXY={{ vault_https_proxy }}
{% if vault_no_proxy -%}
Environment=NO_PROXY={{ vault_no_proxy }}
{% endif -%}
{% for _vault_variable_name, _vault_variable_value in vault_additional_environment_variables.items() -%}
Environment={{ _vault_variable_name }}={{ _vault_variable_value }}
{% endfor -%}
ExecStart=/bin/sh -c 'exec {{ vault_bin_path }}/vault server -config={{ vault_config_path if vault_use_config_path else vault_main_config }} -log-level={{ vault_log_level | lower }} {{ vault_exec_output }}'
ExecReload=/bin/kill --signal HUP $MAINPID
KillMode=process
Expand Down
Loading