2018-05-11 16:11:38 +00:00
|
|
|
---
|
|
|
|
- name: restart vault
|
|
|
|
command: /bin/true
|
|
|
|
notify:
|
|
|
|
- restart vault service
|
2018-06-06 15:40:27 +00:00
|
|
|
- wait for vault up
|
2018-05-11 16:11:38 +00:00
|
|
|
- unseal vault
|
|
|
|
|
|
|
|
- name: wait for vault up
|
|
|
|
uri:
|
|
|
|
url: "{{ vault_leader_url | default('https://localhost:8200') }}/v1/sys/health"
|
|
|
|
headers: "{{ vault_client_headers }}"
|
|
|
|
status_code: "{{ vault_successful_http_codes | join(',') }}"
|
|
|
|
register: vault_health_check
|
|
|
|
until: vault_health_check|succeeded
|
|
|
|
retries: 10
|
|
|
|
delay: "{{ retry_stagger | random + 3 }}"
|
|
|
|
run_once: yes
|
|
|
|
notify: set facts about local Vault health
|
|
|
|
|
|
|
|
- name: wait for vault up nowait
|
|
|
|
uri:
|
|
|
|
url: "{{ vault_leader_url | default('https://localhost:8200') }}/v1/sys/health"
|
|
|
|
headers: "{{ vault_client_headers }}"
|
|
|
|
status_code: "{{ vault_successful_http_codes | join(',') }}"
|
|
|
|
register: vault_health_check
|
|
|
|
run_once: yes
|
|
|
|
failed_when: false
|
|
|
|
notify: set facts about local Vault health
|
|
|
|
|
|
|
|
- name: set facts about local Vault health
|
|
|
|
set_fact:
|
|
|
|
vault_is_running: "{{ vault_health_check.get('status', '-1') in vault_successful_http_codes }}"
|
|
|
|
vault_cluster_is_initialized: "{{ vault_health_check.get('json', {}).get('initialized', false) }}"
|
|
|
|
vault_is_sealed: "{{ vault_health_check.get('json', {}).get('sealed', true) }}"
|
|
|
|
|
|
|
|
- name: restart vault service
|
|
|
|
systemd:
|
|
|
|
daemon_reload: true
|
|
|
|
enabled: yes
|
|
|
|
name: vault
|
|
|
|
state: restarted
|
|
|
|
|
|
|
|
- name: unseal vault
|
|
|
|
hashivault_unseal:
|
|
|
|
url: "{{ vault_leader_url | default('https://localhost:8200') }}"
|
|
|
|
token: "{{ vault_root_token }}"
|
|
|
|
ca_cert: "{{ vault_cert_dir }}/ca.pem"
|
|
|
|
keys: "{{ item }}"
|
|
|
|
with_items: "{{ vault_unseal_keys|default([]) }}"
|