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.

30 lines
1.1 KiB

  1. ---
  2. - name: check_etcd | Check if etcd is up and reachable
  3. uri:
  4. url: "{{ vault_etcd_url.split(',') | first }}/health"
  5. validate_certs: no
  6. client_cert: "{{ etcd_cert_dir }}/node-{{ inventory_hostname }}.pem"
  7. client_key: "{{ etcd_cert_dir }}/node-{{ inventory_hostname }}-key.pem"
  8. return_content: yes
  9. until: vault_etcd_health_check.status == 200 or vault_etcd_health_check.status == 401
  10. retries: 3
  11. delay: 2
  12. delegate_to: "{{groups['etcd'][0]}}"
  13. run_once: true
  14. failed_when: false
  15. register: vault_etcd_health_check
  16. - name: check_etcd | Set fact based off the etcd_health_check response
  17. set_fact:
  18. vault_etcd_available: "{{ vault_etcd_health_check.content }}"
  19. - set_fact:
  20. vault_etcd_available: "{{ vault_etcd_available.health|d()|bool }}"
  21. - name: check_etcd | Fail if etcd is not available and needed
  22. fail:
  23. msg: >
  24. Unable to start Vault cluster! Etcd is not available at
  25. {{ vault_etcd_url.split(',') | first }} however it is needed by Vault as a backend.
  26. when: vault_etcd_needed|d() and not vault_etcd_available