diff --git a/ansible/kubernetes_master/tasks/main.yml b/ansible/kubernetes_master/tasks/main.yml index 1fc0852..bcb8ebb 100644 --- a/ansible/kubernetes_master/tasks/main.yml +++ b/ansible/kubernetes_master/tasks/main.yml @@ -230,14 +230,8 @@ become: true delegate_to: localhost -- name: Generate join command - ansible.builtin.command: kubeadm token create --print-join-command - register: join_command - -- name: Copy join command to local file - ansible.builtin.copy: - content: '"{{ join_command.stdout_lines[0] }}"' - dest: '"/tmp/join-command"' +- name: Generate the Join Command + ansible.builtin.shell: cat /tmp/kubeadm_output | tail -n 2 | sed ':a;N;$!ba;s/\\\n\s*/ /g' > /tmp/join-command delegate_to: localhost - name: Set permissions for the Join Executable diff --git a/ansible/kubernetes_worker/tasks/main.yml b/ansible/kubernetes_worker/tasks/main.yml index 4e5bd8b..f53f63a 100644 --- a/ansible/kubernetes_worker/tasks/main.yml +++ b/ansible/kubernetes_worker/tasks/main.yml @@ -11,6 +11,10 @@ state: present update_cache: true +- name: Set a hostname + ansible.builtin.hostname: + name: worker-{{ hostvars[inventory_hostname]['ansible_default_ipv4']['address'] }} + - name: Install Docker ansible.builtin.apt: name: docker.io