Fixes #10: Set kubernetes_join_command more reliably.

This commit is contained in:
Jeff Geerling 2018-09-06 23:36:16 -05:00
parent b16f139a84
commit 0141762b92
2 changed files with 10 additions and 3 deletions

View File

@ -51,8 +51,15 @@
shell: kubeadm token create --print-join-command shell: kubeadm token create --print-join-command
changed_when: False changed_when: False
when: kubernetes_role == 'master' when: kubernetes_role == 'master'
run_once: True register: kubernetes_join_command_result
register: kubernetes_join_command
- name: Set the kubeadm join command globally.
set_fact:
kubernetes_join_command: "{{ kubernetes_join_command_result.stdout }}"
when: kubernetes_join_command_result.stdout is defined
delegate_to: "{{ item }}"
delegate_facts: True
with_items: "{{ groups['all'] }}"
- include_tasks: node-setup.yml - include_tasks: node-setup.yml
when: kubernetes_role == 'node' when: kubernetes_role == 'node'

View File

@ -1,5 +1,5 @@
--- ---
- name: Join node to Kubernetes master - name: Join node to Kubernetes master
shell: > shell: >
{{ kubernetes_join_command.stdout }} {{ kubernetes_join_command }}
creates=/etc/kubernetes/kubelet.conf creates=/etc/kubernetes/kubelet.conf