Generate certificate key before kubeadm control plane config (#4964)
parent
29307740dd
commit
cdf9a9f4fc
|
@ -10,22 +10,6 @@
|
||||||
tags:
|
tags:
|
||||||
- facts
|
- facts
|
||||||
|
|
||||||
- name: Create kubeadm ControlPlane config
|
|
||||||
template:
|
|
||||||
src: "kubeadm-controlplane.{{ kubeadmConfig_api_version }}.yaml.j2"
|
|
||||||
dest: "{{ kube_config_dir }}/kubeadm-controlplane.yaml"
|
|
||||||
backup: yes
|
|
||||||
when:
|
|
||||||
- inventory_hostname != groups['kube-master']|first
|
|
||||||
- not kubeadm_already_run.stat.exists
|
|
||||||
|
|
||||||
- name: Wait for k8s apiserver
|
|
||||||
wait_for:
|
|
||||||
host: "{{ kubeadm_discovery_address.split(':')[0] }}"
|
|
||||||
port: "{{ kubeadm_discovery_address.split(':')[1] }}"
|
|
||||||
timeout: 180
|
|
||||||
|
|
||||||
|
|
||||||
- name: Upload certificates so they are fresh and not expired
|
- name: Upload certificates so they are fresh and not expired
|
||||||
command: >-
|
command: >-
|
||||||
{{ bin_dir }}/kubeadm init phase
|
{{ bin_dir }}/kubeadm init phase
|
||||||
|
@ -48,6 +32,23 @@
|
||||||
kubeadm_certificate_key: "{{ hostvars[groups['kube-master'][0]]['kubeadm_upload_cert'].stdout_lines[-1] | trim }}"
|
kubeadm_certificate_key: "{{ hostvars[groups['kube-master'][0]]['kubeadm_upload_cert'].stdout_lines[-1] | trim }}"
|
||||||
when: kubeadm_certificate_key is undefined
|
when: kubeadm_certificate_key is undefined
|
||||||
|
|
||||||
|
|
||||||
|
- name: Create kubeadm ControlPlane config
|
||||||
|
template:
|
||||||
|
src: "kubeadm-controlplane.{{ kubeadmConfig_api_version }}.yaml.j2"
|
||||||
|
dest: "{{ kube_config_dir }}/kubeadm-controlplane.yaml"
|
||||||
|
backup: yes
|
||||||
|
when:
|
||||||
|
- inventory_hostname != groups['kube-master']|first
|
||||||
|
- not kubeadm_already_run.stat.exists
|
||||||
|
|
||||||
|
- name: Wait for k8s apiserver
|
||||||
|
wait_for:
|
||||||
|
host: "{{ kubeadm_discovery_address.split(':')[0] }}"
|
||||||
|
port: "{{ kubeadm_discovery_address.split(':')[1] }}"
|
||||||
|
timeout: 180
|
||||||
|
|
||||||
|
|
||||||
- name: check already run
|
- name: check already run
|
||||||
debug:
|
debug:
|
||||||
msg: "{{ kubeadm_already_run.stat.exists }}"
|
msg: "{{ kubeadm_already_run.stat.exists }}"
|
||||||
|
|
Loading…
Reference in New Issue