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
965 B

  1. ---
  2. - name: bootstrap/gen_ca | Ensure vault_cert_dir exists
  3. file:
  4. mode: 0755
  5. path: "{{ vault_cert_dir }}"
  6. state: directory
  7. - name: bootstrap/gen_ca | Generate Root CA in vault-temp
  8. uri:
  9. url: "{{ vault_leader_url }}/v1/pki/root/generate/exported"
  10. headers: "{{ vault_headers }}"
  11. method: POST
  12. body_format: json
  13. body: "{{ vault_ca_options }}"
  14. register: vault_ca_gen
  15. when: inventory_hostname == groups.vault|first and vault_ca_cert_needed
  16. - name: bootstrap/gen_ca | Copy root CA cert locally
  17. copy:
  18. content: "{{ hostvars[groups.vault|first]['vault_ca_gen']['json']['data']['certificate'] }}"
  19. dest: "{{ vault_cert_dir }}/ca.pem"
  20. mode: 0644
  21. when: vault_ca_cert_needed
  22. - name: bootstrap/gen_ca | Copy root CA key locally
  23. copy:
  24. content: "{{ hostvars[groups.vault|first]['vault_ca_gen']['json']['data']['private_key'] }}"
  25. dest: "{{ vault_cert_dir }}/ca-key.pem"
  26. mode: 0640
  27. when: vault_ca_cert_needed