Skip to content

Commit

Permalink
Add possibility to customize wait time after the first Vault start
Browse files Browse the repository at this point in the history
Waiting 30 seconds for each playbook run shouldn't be a default
value as it's only impacting a few users.

It very time consuming especially for playbook runs with `serial`
and multiple nodes clusters (5 nodes: 2mn30s wait time)
  • Loading branch information
bbayszczak authored and bbaassssiiee committed Jun 29, 2021
1 parent b798fdd commit 8c10a77
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,13 @@ The role defines variables in `defaults/main.yml`:
- Should the playbook restart Vault service when needed
- Default value: true

### `vault_start_pause_seconds`

- Some installations may need some time between the first Vault start
and the first restart. Setting this to a value `>0` will add a pause
time after the first Vault start.
- Default value: 0

## TCP Listener Variables

### `vault_tcp_listeners`
Expand Down
3 changes: 3 additions & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ vault_shasums: "vault_{{ vault_version }}_SHA256SUMS"
vault_zip_url: "https://releases.hashicorp.com/vault/{{ vault_version }}/vault_{{ vault_version }}_{{ vault_os }}_{{ vault_architecture }}.zip"
vault_checksum_file_url: "https://releases.hashicorp.com/vault/{{ vault_version }}/vault_{{ vault_version}}_SHA256SUMS"

# Installation
vault_start_pause_seconds: 0

# Install method variables
vault_install_hashi_repo: false
vault_install_remotely: false
Expand Down
5 changes: 3 additions & 2 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -280,11 +280,12 @@
enabled: true
register: start_vault

- name: Pause for 30 seconds to let Vault startup correctly
- name: Pause for {{ vault_start_pause }} seconds to let Vault startup correctly
pause:
seconds: 30
seconds: "{{ vault_start_pause }}"
when:
- start_vault is changed
- vault_start_pause_seconds | int > 0

- name: Restart Vault if needed
meta: flush_handlers
Expand Down

0 comments on commit 8c10a77

Please sign in to comment.