You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
1.4 KiB

  1. ---
  2. # Stop temporary Vault if it's running (can linger if playbook fails out)
  3. - name: stop vault-temp container
  4. shell: docker stop {{ vault_temp_container_name }} || rkt stop {{ vault_temp_container_name }}
  5. failed_when: false
  6. register: vault_temp_stop
  7. changed_when: vault_temp_stop|succeeded
  8. # Check if vault is reachable on the localhost
  9. - name: check_vault | Attempt to pull local https Vault health
  10. uri:
  11. url: "{{ vault_config.listener.tcp.tls_disable|d()|ternary('http', 'https') }}://localhost:{{ vault_port }}/v1/sys/health"
  12. headers: "{{ vault_client_headers }}"
  13. status_code: 200,429,500,501
  14. validate_certs: no
  15. failed_when: false
  16. register: vault_local_service_health
  17. - name: check_vault | Set facts about local Vault health
  18. set_fact:
  19. vault_is_running: "{{ vault_local_service_health|succeeded }}"
  20. vault_is_initialized: "{{ vault_local_service_health.get('json', {}).get('initialized', false) }}"
  21. vault_is_sealed: "{{ vault_local_service_health.get('json', {}).get('sealed', true) }}"
  22. #vault_in_standby: "{{ vault_local_service_health.get('json', {}).get('standby', true) }}"
  23. #vault_run_version: "{{ vault_local_service_health.get('json', {}).get('version', '') }}"
  24. - name: check_vault | Set fact about the Vault cluster's initialization state
  25. set_fact:
  26. vault_cluster_is_initialized: "{{ vault_is_initialized or hostvars[item]['vault_is_initialized'] }}"
  27. with_items: "{{ groups.vault }}"