2016-04-07 15:08:39 +00:00
|
|
|
---
|
2016-05-13 13:08:28 +00:00
|
|
|
- name: "Check_certs | check if the certs have already been generated on first master"
|
2016-04-07 15:08:39 +00:00
|
|
|
stat:
|
|
|
|
path: "{{ kube_cert_dir }}/ca.pem"
|
2016-04-11 07:33:08 +00:00
|
|
|
delegate_to: "{{groups['kube-master'][0]}}"
|
2016-04-07 15:08:39 +00:00
|
|
|
register: kubecert_master
|
|
|
|
run_once: true
|
|
|
|
|
|
|
|
- name: "Check_certs | Set default value for 'sync_certs' and 'gen_certs' to false"
|
|
|
|
set_fact:
|
|
|
|
sync_certs: false
|
|
|
|
gen_certs: false
|
|
|
|
|
|
|
|
- name: "Check_certs | Set 'sync_certs' and 'gen_certs' to true"
|
|
|
|
set_fact:
|
|
|
|
gen_certs: true
|
|
|
|
when: not kubecert_master.stat.exists
|
|
|
|
run_once: true
|
|
|
|
|
|
|
|
- name: "Check certs | check if a cert already exists"
|
|
|
|
stat:
|
|
|
|
path: "{{ kube_cert_dir }}/ca.pem"
|
2016-05-15 22:15:59 +00:00
|
|
|
register: kubecert
|
2016-04-07 15:08:39 +00:00
|
|
|
|
|
|
|
- name: "Check_certs | Set 'sync_certs' to true"
|
|
|
|
set_fact:
|
|
|
|
sync_certs: true
|
|
|
|
when: >-
|
|
|
|
{%- set certs = {'sync': False} -%}
|
|
|
|
{%- for server in play_hosts
|
2016-05-15 22:15:59 +00:00
|
|
|
if (not hostvars[server].kubecert.stat.exists|default(False)) or
|
|
|
|
(hostvars[server].kubecert.stat.checksum|default('') != kubecert_master.stat.checksum|default('')) -%}
|
2016-04-07 15:08:39 +00:00
|
|
|
{%- set _ = certs.update({'sync': True}) -%}
|
|
|
|
{%- endfor -%}
|
|
|
|
{{ certs.sync }}
|
|
|
|
run_once: true
|