diff --git a/ansible/roles/firstboot/files/ansible_payload/bootstrap/roles/metacluster/tasks/k3s.yml b/ansible/roles/firstboot/files/ansible_payload/bootstrap/roles/metacluster/tasks/k3s.yml index 647c122..f08cb99 100644 --- a/ansible/roles/firstboot/files/ansible_payload/bootstrap/roles/metacluster/tasks/k3s.yml +++ b/ansible/roles/firstboot/files/ansible_payload/bootstrap/roles/metacluster/tasks/k3s.yml @@ -42,19 +42,30 @@ retries: "{{ playbook.retries }}" delay: "{{ (storage_benchmark | int) * (playbook.delay.medium | int) }}" -- name: Install kubectl tab-completion +- name: Install tab-completion ansible.builtin.shell: - cmd: kubectl completion bash | tee /etc/bash_completion.d/kubectl + cmd: |- + {{ item }} completion bash > /etc/bash_completion.d/{{ item }} + creates: /etc/bash_completion.d/{{ item }} + loop: + - kubectl + - helm + - step -- name: Initialize tempfile - ansible.builtin.tempfile: - state: file - register: kubeconfig +- name: Create kubeconfig dictionary + ansible.builtin.set_fact: + kubeconfig: "{{ { 'path': ansible_env.HOME ~ '/.kube/config' } }}" + +- name: Create kubeconfig target folder + ansible.builtin.file: + path: "{{ kubeconfig.path | dirname }}" + state: directory - name: Retrieve kubeconfig ansible.builtin.command: cmd: kubectl config view --raw register: kubectl_config + no_log: true - name: Store kubeconfig in tempfile ansible.builtin.copy: diff --git a/ansible/roles/firstboot/files/ansible_payload/common/roles/cleanup/tasks/main.yml b/ansible/roles/firstboot/files/ansible_payload/common/roles/cleanup/tasks/main.yml index b6650db..07ff235 100644 --- a/ansible/roles/firstboot/files/ansible_payload/common/roles/cleanup/tasks/main.yml +++ b/ansible/roles/firstboot/files/ansible_payload/common/roles/cleanup/tasks/main.yml @@ -1,12 +1,6 @@ - import_tasks: service.yml - import_tasks: cron.yml -- name: Cleanup tempfile - ansible.builtin.file: - path: "{{ kubeconfig.path }}" - state: absent - when: kubeconfig.path is defined - # - name: Reboot host # ansible.builtin.shell: # cmd: systemctl reboot