c12s-kubespray/roles/kubernetes/secrets/tasks/check-tokens.yml
Bogdan Dobrelya 6fa44458db Add kubeadm init, join
* Implement kubeadm init,join for Debian OS family (PoC) with
  the external etcd option set.
* Make certs/tokens management optional and depending on
  the use_kubeadm var
* Do not delegate static pods and config management to kubeadm
  and remove produced artifacts to be regenerated by ansible.
* Add new set of system pods manifests templates based on that kubeadm
  produces by default and parametrize it by ansible vars
* Fix apiserver container logging to follow 12-factor apps
  and scheduler/controller-manager logging setup

Signed-off-by: Bogdan Dobrelya <bdobrelia@mirantis.com>
2016-10-20 11:34:13 +02:00

36 lines
1.1 KiB
YAML

---
- name: "Check_tokens | check if the tokens have already been generated on first master"
stat:
path: "{{ kube_token_dir }}/tokens.csv"
delegate_to: "{{groups['kube-master'][0]}}"
register: known_tokens_master
run_once: true
- name: "Check_tokens | Set default value for 'sync_tokens' and 'gen_tokens' to false"
set_fact:
sync_tokens: false
gen_tokens: false
- name: "Check_tokens | Set 'sync_tokens' and 'gen_tokens' to true"
set_fact:
gen_tokens: true
when: not known_tokens_master.stat.exists
run_once: true
- name: "Check tokens | check if a cert already exists"
stat:
path: "{{ kube_cert_dir }}/ca.pem"
register: known_tokens
- name: "Check_tokens | Set 'sync_tokens' to true"
set_fact:
sync_tokens: true
when: >-
{%- set tokens = {'sync': False} -%}
{%- for server in groups['kube-master']
if (not hostvars[server].known_tokens.stat.exists) or
(hostvars[server].known_tokens.stat.checksum != known_tokens_master.stat.checksum|default('')) -%}
{%- set _ = tokens.update({'sync': True}) -%}
{%- endfor -%}
{{ tokens.sync }}
run_once: true