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.

32 lines
1.2 KiB

  1. ---
  2. - name: "bootstrap/ca_trust | pull CA from cert from {{groups.vault|first}}"
  3. command: "cat {{ vault_cert_dir }}/ca.pem"
  4. register: vault_cert_file_cat
  5. delegate_to: "{{ groups['vault']|first }}"
  6. # This part is mostly stolen from the etcd role
  7. - name: bootstrap/ca_trust | target ca-certificate store file
  8. set_fact:
  9. ca_cert_path: >-
  10. {% if ansible_os_family == "Debian" -%}
  11. /usr/local/share/ca-certificates/vault-ca.crt
  12. {%- elif ansible_os_family == "RedHat" -%}
  13. /etc/pki/ca-trust/source/anchors/vault-ca.crt
  14. {%- elif ansible_os_family in ["CoreOS", "Container Linux by CoreOS"] -%}
  15. /etc/ssl/certs/vault-ca.pem
  16. {%- endif %}
  17. - name: bootstrap/ca_trust | add CA to trusted CA dir
  18. copy:
  19. content: "{{ vault_cert_file_cat.get('stdout') }}"
  20. dest: "{{ ca_cert_path }}"
  21. register: vault_ca_cert
  22. - name: bootstrap/ca_trust | update ca-certificates (Debian/Ubuntu/CoreOS)
  23. command: update-ca-certificates
  24. when: vault_ca_cert.changed and ansible_os_family in ["Debian", "CoreOS", "Container Linux by CoreOS"]
  25. - name: bootstrap/ca_trust | update ca-certificates (RedHat)
  26. command: update-ca-trust extract
  27. when: vault_ca_cert.changed and ansible_os_family == "RedHat"