diff --git a/ansible/roles/firstboot/files/ansible_payload/playbook.yml b/ansible/roles/firstboot/files/ansible_payload/playbook.yml index bbb4610..56bb081 100644 --- a/ansible/roles/firstboot/files/ansible_payload/playbook.yml +++ b/ansible/roles/firstboot/files/ansible_payload/playbook.yml @@ -19,4 +19,5 @@ kubernetes.core.k8s: src: "{{ item }}" state: present + kubeconfig: "{{ kubeconfig.path }}" with_fileglob: /var/lib/rancher/k3s/server/manifests/*.yaml diff --git a/ansible/roles/firstboot/files/ansible_payload/roles/metacluster/tasks/main.yml b/ansible/roles/firstboot/files/ansible_payload/roles/metacluster/tasks/main.yml index 40f242b..d62a6e3 100644 --- a/ansible/roles/firstboot/files/ansible_payload/roles/metacluster/tasks/main.yml +++ b/ansible/roles/firstboot/files/ansible_payload/roles/metacluster/tasks/main.yml @@ -13,6 +13,23 @@ INSTALL_K3S_EXEC: 'server --cluster-init --disable local-storage' when: ansible_facts.services['k3s.service'] is undefined + - name: Initialize tempfile + ansible.builtin.tempfile: + state: file + register: kubeconfig + + - name: Retrieve kubeconfig + ansible.builtin.command: + cmd: kubectl config view --raw + register: kubectl_config + + - name: Store kubeconfig in tempfile + ansible.builtin.copy: + dest: "{{ kubeconfig.path }}" + content: "{{ kubectl_config.stdout }}" + mode: 0600 + no_log: true + - name: Configure traefik dashboard ingress ansible.builtin.template: src: ingressroute.j2 @@ -55,25 +72,6 @@ ansible.builtin.shell: cmd: kubectl completion bash | tee /etc/bash_completion.d/kubectl -- block: - - - name: Initialize tempfile - ansible.builtin.tempfile: - state: file - register: kubeconfig - - - name: Retrieve kubeconfig - ansible.builtin.command: - cmd: kubectl config view --raw - register: kubectl_config - - - name: Store kubeconfig in tempfile - ansible.builtin.copy: - dest: "{{ kubeconfig.path }}" - content: "{{ kubectl_config.stdout }}" - mode: 0600 - no_log: true - - block: - name: Extract container images diff --git a/ansible/roles/metacluster/tasks/components.yml b/ansible/roles/metacluster/tasks/components.yml index 41e1375..86888c4 100644 --- a/ansible/roles/metacluster/tasks/components.yml +++ b/ansible/roles/metacluster/tasks/components.yml @@ -66,11 +66,6 @@ # loop: "{{ lookup('ansible.builtin.dict', components) | map(attribute='value.manifests') | list | select('defined') | flatten }}" # loop_control: # label: "{{ item.type + '/' + item.name }}" -# notify: -# - Apply manifests - -# - name: Trigger handlers -# ansible.builtin.meta: flush_handlers - name: Compress tarballs community.general.archive: diff --git a/ansible/roles/metacluster/tasks/k3s.yml b/ansible/roles/metacluster/tasks/k3s.yml index 7947c06..d4cf30a 100644 --- a/ansible/roles/metacluster/tasks/k3s.yml +++ b/ansible/roles/metacluster/tasks/k3s.yml @@ -38,8 +38,3 @@ loop: "{{ platform.packaged_components }}" loop_control: label: "{{ item.name }}" - notify: - - Apply manifests - -- name: Trigger handlers - ansible.builtin.meta: flush_handlers