2017-01-13 20:31:10 +00:00
|
|
|
---
|
|
|
|
|
2017-06-29 17:46:27 +00:00
|
|
|
- name: "bootstrap/ca_trust | pull CA from cert from {{groups.vault|first}}"
|
2017-01-13 20:31:10 +00:00
|
|
|
command: "cat {{ vault_cert_dir }}/ca.pem"
|
|
|
|
register: vault_cert_file_cat
|
2017-04-19 15:52:51 +00:00
|
|
|
delegate_to: "{{ groups['vault']|first }}"
|
2017-01-13 20:31:10 +00:00
|
|
|
|
|
|
|
# This part is mostly stolen from the etcd role
|
2017-02-08 21:41:36 +00:00
|
|
|
- name: bootstrap/ca_trust | target ca-certificate store file
|
2017-01-13 20:31:10 +00:00
|
|
|
set_fact:
|
|
|
|
ca_cert_path: >-
|
|
|
|
{% if ansible_os_family == "Debian" -%}
|
2017-08-30 13:03:22 +00:00
|
|
|
/usr/local/share/ca-certificates/vault-ca.crt
|
2017-01-13 20:31:10 +00:00
|
|
|
{%- elif ansible_os_family == "RedHat" -%}
|
2017-08-30 13:03:22 +00:00
|
|
|
/etc/pki/ca-trust/source/anchors/vault-ca.crt
|
2017-02-16 16:25:03 +00:00
|
|
|
{%- elif ansible_os_family in ["CoreOS", "Container Linux by CoreOS"] -%}
|
2017-08-30 13:03:22 +00:00
|
|
|
/etc/ssl/certs/vault-ca.pem
|
2017-01-13 20:31:10 +00:00
|
|
|
{%- endif %}
|
|
|
|
|
2017-02-08 21:41:36 +00:00
|
|
|
- name: bootstrap/ca_trust | add CA to trusted CA dir
|
2017-01-13 20:31:10 +00:00
|
|
|
copy:
|
2017-04-19 15:52:51 +00:00
|
|
|
content: "{{ vault_cert_file_cat.get('stdout') }}"
|
2017-01-13 20:31:10 +00:00
|
|
|
dest: "{{ ca_cert_path }}"
|
|
|
|
register: vault_ca_cert
|
|
|
|
|
2017-02-08 21:41:36 +00:00
|
|
|
- name: bootstrap/ca_trust | update ca-certificates (Debian/Ubuntu/CoreOS)
|
2017-01-13 20:31:10 +00:00
|
|
|
command: update-ca-certificates
|
2017-02-16 16:25:03 +00:00
|
|
|
when: vault_ca_cert.changed and ansible_os_family in ["Debian", "CoreOS", "Container Linux by CoreOS"]
|
2017-01-13 20:31:10 +00:00
|
|
|
|
2017-02-08 21:41:36 +00:00
|
|
|
- name: bootstrap/ca_trust | update ca-certificates (RedHat)
|
2017-01-13 20:31:10 +00:00
|
|
|
command: update-ca-trust extract
|
|
|
|
when: vault_ca_cert.changed and ansible_os_family == "RedHat"
|