kubespray/roles/vault/tasks/bootstrap/ca_trust.yml

33 lines
1.2 KiB
YAML
Raw Normal View History

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