Skip to content

Commit da957e0

Browse files
feat: allow additional environment variables (#366)
1 parent b59885e commit da957e0

File tree

3 files changed

+18
-0
lines changed

3 files changed

+18
-0
lines changed

defaults/main.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,9 @@ vault_listener_localhost_enable: false
9292
vault_http_proxy: ""
9393
vault_https_proxy: ""
9494
vault_no_proxy: ""
95+
vault_additional_environment_variables: {}
96+
# FOO: bar
97+
# FOO2: bar2
9598

9699
# ---------------------------------------------------------------------------
97100
# TCP listeners

role_variables.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -770,6 +770,18 @@ available starting at Vault version 1.4.
770770
- Comma separated values which specify hosts that should be exluded from proxying. Follows [golang conventions](https://godoc.org/golang.org/x/net/http/httpproxy)
771771
- Default value: `""`
772772

773+
## `vault_additional_environment_variables`
774+
775+
- Dict of items of type `Dict[str, str]` to add additional environment variables to the systemd service
776+
- Default value: `{}`
777+
778+
Example:
779+
780+
```yaml
781+
vault_additional_environment_variables:
782+
FOO: bar
783+
```
784+
773785
## `vault_cluster_address`
774786

775787
- Address to bind to for cluster server-to-server requests

templates/vault_service_systemd.j2

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ Environment=HTTPS_PROXY={{ vault_https_proxy }}
3737
{% if vault_no_proxy -%}
3838
Environment=NO_PROXY={{ vault_no_proxy }}
3939
{% endif -%}
40+
{% for _vault_variable_name, _vault_variable_value in vault_additional_environment_variables.items() -%}
41+
Environment={{ _vault_variable_name }}={{ _vault_variable_value }}
42+
{% endfor -%}
4043
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 }}'
4144
ExecReload=/bin/kill --signal HUP $MAINPID
4245
KillMode=process

0 commit comments

Comments
 (0)