2017-02-09 05:41:36 +08:00
|
|
|
---
|
2017-04-12 18:37:50 +08:00
|
|
|
- include: sync_etcd_master_certs.yml
|
|
|
|
when: inventory_hostname in groups.etcd
|
2017-10-05 15:43:04 +08:00
|
|
|
tags:
|
|
|
|
- etcd-secrets
|
2017-04-12 18:37:50 +08:00
|
|
|
|
|
|
|
- include: sync_etcd_node_certs.yml
|
|
|
|
when: inventory_hostname in etcd_node_cert_hosts
|
2017-10-05 15:43:04 +08:00
|
|
|
tags:
|
|
|
|
- etcd-secrets
|
2017-04-12 18:37:50 +08:00
|
|
|
|
2017-02-09 05:41:36 +08:00
|
|
|
# Issue master certs to Etcd nodes
|
|
|
|
- include: ../../vault/tasks/shared/issue_cert.yml
|
|
|
|
vars:
|
2017-09-02 03:51:37 +08:00
|
|
|
issue_cert_common_name: "etcd:master:{{ item.rsplit('/', 1)[1].rsplit('.', 1)[0] }}"
|
2018-01-09 19:37:34 +08:00
|
|
|
issue_cert_alt_names: "{{ groups['etcd'] + ['localhost'] + (etcd_cert_alt_names)|default() }}"
|
2017-02-09 05:41:36 +08:00
|
|
|
issue_cert_copy_ca: "{{ item == etcd_master_certs_needed|first }}"
|
|
|
|
issue_cert_file_group: "{{ etcd_cert_group }}"
|
|
|
|
issue_cert_file_owner: kube
|
|
|
|
issue_cert_hosts: "{{ groups.etcd }}"
|
|
|
|
issue_cert_ip_sans: >-
|
|
|
|
[
|
|
|
|
{%- for host in groups.etcd -%}
|
|
|
|
"{{ hostvars[host]['ansible_default_ipv4']['address'] }}",
|
2017-08-20 18:53:58 +08:00
|
|
|
{%- if hostvars[host]['ip'] is defined -%}
|
|
|
|
"{{ hostvars[host]['ip'] }}",
|
|
|
|
{%- endif -%}
|
2017-02-09 05:41:36 +08:00
|
|
|
{%- endfor -%}
|
|
|
|
"127.0.0.1","::1"
|
|
|
|
]
|
|
|
|
issue_cert_path: "{{ item }}"
|
|
|
|
issue_cert_role: etcd
|
|
|
|
issue_cert_url: "{{ hostvars[groups.vault|first]['vault_leader_url'] }}"
|
2017-08-30 21:03:22 +08:00
|
|
|
issue_cert_mount_path: "{{ etcd_vault_mount_path }}"
|
2017-02-09 05:41:36 +08:00
|
|
|
with_items: "{{ etcd_master_certs_needed|d([]) }}"
|
|
|
|
when: inventory_hostname in groups.etcd
|
|
|
|
notify: set etcd_secret_changed
|
|
|
|
|
|
|
|
# Issue node certs to everyone else
|
|
|
|
- include: ../../vault/tasks/shared/issue_cert.yml
|
|
|
|
vars:
|
2017-09-02 03:51:37 +08:00
|
|
|
issue_cert_common_name: "etcd:node:{{ item.rsplit('/', 1)[1].rsplit('.', 1)[0] }}"
|
2017-02-09 05:41:36 +08:00
|
|
|
issue_cert_alt_names: "{{ etcd_node_cert_hosts }}"
|
|
|
|
issue_cert_copy_ca: "{{ item == etcd_node_certs_needed|first }}"
|
|
|
|
issue_cert_file_group: "{{ etcd_cert_group }}"
|
|
|
|
issue_cert_file_owner: kube
|
|
|
|
issue_cert_hosts: "{{ etcd_node_cert_hosts }}"
|
|
|
|
issue_cert_ip_sans: >-
|
|
|
|
[
|
|
|
|
{%- for host in etcd_node_cert_hosts -%}
|
|
|
|
"{{ hostvars[host]['ansible_default_ipv4']['address'] }}",
|
2017-08-20 18:53:58 +08:00
|
|
|
{%- if hostvars[host]['ip'] is defined -%}
|
|
|
|
"{{ hostvars[host]['ip'] }}",
|
|
|
|
{%- endif -%}
|
2017-02-09 05:41:36 +08:00
|
|
|
{%- endfor -%}
|
|
|
|
"127.0.0.1","::1"
|
|
|
|
]
|
|
|
|
issue_cert_path: "{{ item }}"
|
|
|
|
issue_cert_role: etcd
|
|
|
|
issue_cert_url: "{{ hostvars[groups.vault|first]['vault_leader_url'] }}"
|
2017-08-30 21:03:22 +08:00
|
|
|
issue_cert_mount_path: "{{ etcd_vault_mount_path }}"
|
2017-02-09 05:41:36 +08:00
|
|
|
with_items: "{{ etcd_node_certs_needed|d([]) }}"
|
|
|
|
when: inventory_hostname in etcd_node_cert_hosts
|
|
|
|
notify: set etcd_secret_changed
|