2017-02-08 21:41:36 +00:00
|
|
|
---
|
2018-01-29 11:37:48 +00:00
|
|
|
- include_tasks: sync_etcd_master_certs.yml
|
2017-04-12 10:37:50 +00:00
|
|
|
when: inventory_hostname in groups.etcd
|
2017-10-05 07:43:04 +00:00
|
|
|
tags:
|
|
|
|
- etcd-secrets
|
2017-04-12 10:37:50 +00:00
|
|
|
|
2018-01-29 11:37:48 +00:00
|
|
|
- include_tasks: sync_etcd_node_certs.yml
|
2017-04-12 10:37:50 +00:00
|
|
|
when: inventory_hostname in etcd_node_cert_hosts
|
2017-10-05 07:43:04 +00:00
|
|
|
tags:
|
|
|
|
- etcd-secrets
|
2017-04-12 10:37:50 +00:00
|
|
|
|
2017-02-08 21:41:36 +00:00
|
|
|
# Issue master certs to Etcd nodes
|
2018-01-29 11:37:48 +00:00
|
|
|
- include_tasks: ../../vault/tasks/shared/issue_cert.yml
|
2017-02-08 21:41:36 +00:00
|
|
|
vars:
|
2017-09-01 19:51:37 +00:00
|
|
|
issue_cert_common_name: "etcd:master:{{ item.rsplit('/', 1)[1].rsplit('.', 1)[0] }}"
|
2018-01-09 11:37:34 +00:00
|
|
|
issue_cert_alt_names: "{{ groups['etcd'] + ['localhost'] + (etcd_cert_alt_names)|default() }}"
|
2017-02-08 21:41:36 +00: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 10:53:58 +00:00
|
|
|
{%- if hostvars[host]['ip'] is defined -%}
|
|
|
|
"{{ hostvars[host]['ip'] }}",
|
|
|
|
{%- endif -%}
|
2017-02-08 21:41:36 +00: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 13:03:22 +00:00
|
|
|
issue_cert_mount_path: "{{ etcd_vault_mount_path }}"
|
2017-02-08 21:41:36 +00: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
|
2018-01-29 11:37:48 +00:00
|
|
|
- include_tasks: ../../vault/tasks/shared/issue_cert.yml
|
2017-02-08 21:41:36 +00:00
|
|
|
vars:
|
2017-09-01 19:51:37 +00:00
|
|
|
issue_cert_common_name: "etcd:node:{{ item.rsplit('/', 1)[1].rsplit('.', 1)[0] }}"
|
2017-02-08 21:41:36 +00: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 10:53:58 +00:00
|
|
|
{%- if hostvars[host]['ip'] is defined -%}
|
|
|
|
"{{ hostvars[host]['ip'] }}",
|
|
|
|
{%- endif -%}
|
2017-02-08 21:41:36 +00: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 13:03:22 +00:00
|
|
|
issue_cert_mount_path: "{{ etcd_vault_mount_path }}"
|
2017-02-08 21:41:36 +00:00
|
|
|
with_items: "{{ etcd_node_certs_needed|d([]) }}"
|
|
|
|
when: inventory_hostname in etcd_node_cert_hosts
|
|
|
|
notify: set etcd_secret_changed
|
2018-05-30 09:15:11 +00:00
|
|
|
|
|
|
|
- fail:
|