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.

21 lines
825 B

  1. ---
  2. - name: find_leader | Find the current http Vault leader
  3. uri:
  4. url: "{{ vault_config.listener.tcp.tls_disable|d()|ternary('http', 'https') }}://localhost:{{ vault_port }}/v1/sys/health"
  5. headers: "{{ hostvars[groups.vault|first]['vault_headers'] }}"
  6. method: HEAD
  7. status_code: 200,429,501,503
  8. register: vault_leader_check
  9. until: "vault_leader_check|succeeded"
  10. retries: 10
  11. - name: find_leader | Set fact for current http leader
  12. set_fact:
  13. vault_leader_url: "{{ vault_config.listener.tcp.tls_disable|d()|ternary('http', 'https') }}://{{ inventory_hostname }}:{{ vault_port }}"
  14. with_items: "{{ groups.vault }}"
  15. when: "hostvars[item]['vault_leader_check'].get('status') in [200,501,503]"
  16. # run_once: true
  17. - name: find_leader| show vault_leader_url
  18. debug: var=vault_leader_url verbosity=2