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.

29 lines
996 B

  1. ---
  2. - name: "bootstrap/gen_ca | Ensure cert_dir {{ gen_ca_cert_dir }} exists"
  3. file:
  4. mode: 0755
  5. path: "{{ gen_ca_cert_dir }}"
  6. state: directory
  7. - name: "bootstrap/gen_ca | Generate {{ gen_ca_mount_path }} root CA"
  8. uri:
  9. url: "{{ vault_leader_url }}/v1/{{ gen_ca_mount_path }}/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. delegate_to: "{{ groups.vault|first }}"
  16. run_once: true
  17. - name: "bootstrap/gen_ca | Copy {{ gen_ca_mount_path }} root CA cert locally"
  18. copy:
  19. content: "{{ hostvars[groups.vault|first]['vault_ca_gen']['json']['data']['certificate'] }}"
  20. dest: "{{ gen_ca_cert_dir }}/ca.pem"
  21. mode: 0644
  22. - name: "bootstrap/gen_ca | Copy {{ gen_ca_mount_path }} root CA key locally"
  23. copy:
  24. content: "{{ hostvars[groups.vault|first]['vault_ca_gen']['json']['data']['private_key'] }}"
  25. dest: "{{ gen_ca_cert_dir }}/ca-key.pem"
  26. mode: 0640