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.

72 lines
2.5 KiB

  1. ---
  2. - import_tasks: ../shared/check_etcd.yml
  3. vars:
  4. vault_etcd_needed: no
  5. when: inventory_hostname in groups.vault
  6. - import_tasks: ../shared/check_vault.yml
  7. when: inventory_hostname in groups.vault
  8. - import_tasks: sync_secrets.yml
  9. when: inventory_hostname in groups.vault
  10. - import_tasks: ../shared/find_leader.yml
  11. when: inventory_hostname in groups.vault and vault_cluster_is_initialized
  12. - import_tasks: sync_vault_certs.yml
  13. when: inventory_hostname in groups.vault
  14. - import_tasks: sync_etcd_certs.yml
  15. when: inventory_hostname in groups.etcd
  16. - import_tasks: start_vault_temp.yml
  17. when: inventory_hostname == groups.vault|first and not vault_cluster_is_initialized
  18. - name: vault | Set fact about vault leader url
  19. set_fact:
  20. vault_leader_url: "{{ hostvars[groups.vault|first]['vault_leader_url'] }}"
  21. when: not vault_cluster_is_initialized
  22. - import_tasks: create_mounts.yml
  23. when: inventory_hostname == groups.vault|first and not vault_cluster_is_initialized
  24. - include_tasks: ../shared/auth_backend.yml
  25. vars:
  26. auth_backend_description: A Username/Password Auth Backend primarily used for services needing to issue certificates
  27. auth_backend_path: userpass
  28. auth_backend_type: userpass
  29. when: inventory_hostname == groups.vault|first and not vault_cluster_is_initialized
  30. - include_tasks: create_roles.yml
  31. with_items:
  32. - "{{ vault_pki_mounts.vault }}"
  33. - "{{ vault_pki_mounts.etcd }}"
  34. loop_control:
  35. loop_var: mount
  36. when: inventory_hostname == groups.vault|first and not vault_cluster_is_initialized
  37. - include_tasks: ../shared/gen_ca.yml
  38. vars:
  39. gen_ca_cert_dir: "{{ vault_pki_mounts.vault.cert_dir }}"
  40. gen_ca_mount_path: "/{{ vault_pki_mounts.vault.name }}"
  41. gen_ca_vault_headers: "{{ vault_headers }}"
  42. gen_ca_vault_options: "{{ vault_ca_options.vault }}"
  43. gen_ca_copy_group: "kube-master"
  44. when: >-
  45. inventory_hostname in groups.vault
  46. and not vault_cluster_is_initialized
  47. and vault_ca_cert_needed
  48. - include_tasks: ../shared/gen_ca.yml
  49. vars:
  50. gen_ca_cert_dir: "{{ vault_pki_mounts.etcd.cert_dir }}"
  51. gen_ca_mount_path: "/{{ vault_pki_mounts.etcd.name }}"
  52. gen_ca_vault_headers: "{{ vault_headers }}"
  53. gen_ca_vault_options: "{{ vault_ca_options.etcd }}"
  54. gen_ca_copy_group: "etcd"
  55. when: inventory_hostname in groups.etcd and not vault_cluster_is_initialized and vault_etcd_ca_cert_needed
  56. - import_tasks: gen_vault_certs.yml
  57. when: inventory_hostname in groups.vault and not vault_cluster_is_initialized and vault_api_cert_needed
  58. - import_tasks: ca_trust.yml