From 0b939a495bfe1340d5af5f55bb9fc87dd843f166 Mon Sep 17 00:00:00 2001 From: Matthew Mosesohn Date: Thu, 5 Jul 2018 12:27:45 +0300 Subject: [PATCH] Improve vault etcd initialization check (#2959) --- roles/vault/tasks/cluster/init.yml | 1 - roles/vault/tasks/shared/check_vault.yml | 6 ++++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/roles/vault/tasks/cluster/init.yml b/roles/vault/tasks/cluster/init.yml index 30f64f3b1..fea670df2 100644 --- a/roles/vault/tasks/cluster/init.yml +++ b/roles/vault/tasks/cluster/init.yml @@ -1,5 +1,4 @@ --- - - name: cluster/init | wait for vault command: /bin/true notify: wait for vault up diff --git a/roles/vault/tasks/shared/check_vault.yml b/roles/vault/tasks/shared/check_vault.yml index 1ffd515fd..999a36f32 100644 --- a/roles/vault/tasks/shared/check_vault.yml +++ b/roles/vault/tasks/shared/check_vault.yml @@ -9,7 +9,9 @@ # Check if vault is reachable on the localhost - name: check_vault | Attempt to pull local https Vault health command: /bin/true - notify: wait for vault up nowait + notify: + - wait for vault up nowait + - set facts about local Vault health - meta: flush_handlers @@ -44,6 +46,6 @@ vault_cluster_is_initialized: >- {{ vault_is_initialized or hostvars[item]['vault_is_initialized'] or - 'Key not found' not in vault_etcd_exists.stdout|default('Key not found') }} + ('value' in vault_etcd_exists.stdout|default('')) }} with_items: "{{ groups.vault }}" run_once: true