bf0af1cd3d
* using separated vault roles for generate certs with different `O` (Organization) subject field; * configure vault roles for issuing certificates with different `CN` (Common name) subject field; * set `CN` and `O` to `kubernetes` and `etcd` certificates; * vault/defaults vars definition was simplified; * vault dirs variables defined in kubernetes-defaults foles for using shared tasks in etcd and kubernetes/secrets roles; * upgrade vault to 0.8.1; * generate random vault user password for each role by default; * fix `serial` file name for vault certs; * move vault auth request to issue_cert tasks; * enable `RBAC` in vault CI;
29 lines
1,007 B
YAML
29 lines
1,007 B
YAML
---
|
|
- name: "bootstrap/gen_ca | Ensure cert_dir {{ gen_ca_cert_dir }} exists"
|
|
file:
|
|
mode: 0755
|
|
path: "{{ gen_ca_cert_dir }}"
|
|
state: directory
|
|
|
|
- name: "bootstrap/gen_ca | Generate {{ gen_ca_mount_path }} root CA"
|
|
uri:
|
|
url: "{{ vault_leader_url }}/v1/{{ gen_ca_mount_path }}/root/generate/exported"
|
|
headers: "{{ gen_ca_vault_headers }}"
|
|
method: POST
|
|
body_format: json
|
|
body: "{{ gen_ca_vault_options }}"
|
|
register: vault_ca_gen
|
|
delegate_to: "{{ groups.vault|first }}"
|
|
run_once: true
|
|
|
|
- name: "bootstrap/gen_ca | Copy {{ gen_ca_mount_path }} root CA cert locally"
|
|
copy:
|
|
content: "{{ hostvars[groups.vault|first]['vault_ca_gen']['json']['data']['certificate'] }}"
|
|
dest: "{{ gen_ca_cert_dir }}/ca.pem"
|
|
mode: 0644
|
|
|
|
- name: "bootstrap/gen_ca | Copy {{ gen_ca_mount_path }} root CA key locally"
|
|
copy:
|
|
content: "{{ hostvars[groups.vault|first]['vault_ca_gen']['json']['data']['private_key'] }}"
|
|
dest: "{{ gen_ca_cert_dir }}/ca-key.pem"
|
|
mode: 0640
|