Skip to content

Commit

Permalink
Improve Vault Support for Namespace, Tokens
Browse files Browse the repository at this point in the history
This adds support for Vault namespaces (from Vault Enterprise).
Additionally, this ensures that a vault token is not installed on client
nodes. Per the nomad documentation, this token only needs be installed
on servers, and tokens will be delegated appropriately to client nodes.

Addresses ansible-community#101
  • Loading branch information
adawalli committed Jul 23, 2020
1 parent 0a2cf09 commit a98b411
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,12 @@ in many Ansible versions, so this feature might not always work.

### `nomad_vault_token`

- Vault token used by nomad
- Vault token used by nomad. Will only be installed on servers.
- Default value: **""**

### `nomad_vault_namespace`

- Vault namespace used by nomad
- Default value: **""**

### `nomad_docker_enable`
Expand Down
1 change: 1 addition & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ nomad_vault_key_file: ""
nomad_vault_tls_server_name: ""
nomad_vault_tls_skip_verify: false
nomad_vault_token: ""
nomad_vault_namespace: ""

### Docker
nomad_docker_enable: "{{ lookup('env','NOMAD_DOCKER_ENABLE') | default('false', true) }}"
Expand Down
3 changes: 3 additions & 0 deletions templates/base.hcl.j2
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,10 @@ vault {
key_file = "{{ nomad_vault_key_file }}"
tls_server_name = "{{ nomad_vault_tls_server_name }}"
tls_skip_verify = {{ nomad_vault_tls_skip_verify | bool | lower }}
{%if nomad_node_role != 'client' %}
token = "{{ nomad_vault_token }}"
{% endif %}
namespace = "{{ nomad_vault_namespace }}"
}

{% if nomad_telemetry | default(False) | bool == True %}
Expand Down

0 comments on commit a98b411

Please sign in to comment.