diff options
| author | alex <alex@pdp7.net> | 2023-08-27 12:17:49 +0000 |
|---|---|---|
| committer | alex <alex@pdp7.net> | 2023-08-27 12:19:10 +0000 |
| commit | ae6a8db1aabebc8238f9f481e7e2928bb8f5429a (patch) | |
| tree | a624ccf803dbfbc8e950834080ee658d54114bdd /personal_infra/playbooks | |
| parent | 5a7c9096d3d203edab04418178f79e605d7cd2c4 (diff) | |
Improve Talos playbook
* Major reordering needed so kubeconfig can be fetched
Diffstat (limited to 'personal_infra/playbooks')
| -rw-r--r-- | personal_infra/playbooks/roles/talos/tasks/main.yaml | 55 |
1 files changed, 29 insertions, 26 deletions
diff --git a/personal_infra/playbooks/roles/talos/tasks/main.yaml b/personal_infra/playbooks/roles/talos/tasks/main.yaml index f9bfa201..44189484 100644 --- a/personal_infra/playbooks/roles/talos/tasks/main.yaml +++ b/personal_infra/playbooks/roles/talos/tasks/main.yaml @@ -1,20 +1,4 @@ --- -- name: check node ready - k8s_info: - context: "admin@{{ talos_host.talos_cluster }}" - kind: Node - wait: true - wait_condition: - status: True - type: Ready - delegate_to: 127.0.0.1 - register: nodes - ignore_errors: true - -- name: setup proxmox hosts - import_tasks: proxmox.yml - when: "'k8s_proxmox' in group_names and not 'resources' in nodes or nodes.resources|length == 0" - - name: generate controlplane patch copy: content: | @@ -38,34 +22,53 @@ role: ingress-controller dest: "{{ inventory_dir }}/talos/host-{{ inventory_hostname }}.patch" delegate_to: 127.0.0.1 - when: "not 'resources' in nodes or nodes.resources|length == 0" - name: generate controlplane config shell: cmd: talosctl gen config -t controlplane -o talos/host-{{ inventory_hostname }}.yaml --with-secrets <(ansible-vault view talos/{{ talos_host.talos_cluster }}-secrets.yaml) --config-patch-control-plane @talos/host-{{ inventory_hostname }}.patch {{ talos_host.talos_cluster }} {{ talos_clusters[talos_host.talos_cluster].endpoint }} --force chdir: "{{ inventory_dir }}" delegate_to: 127.0.0.1 - when: "not 'resources' in nodes or nodes.resources|length == 0" - -- name: apply config - command: - cmd: talosctl apply-config --insecure --nodes {{ ip.stdout }} --file talos/host-{{ inventory_hostname }}.yaml - chdir: "{{ inventory_dir }}" - delegate_to: 127.0.0.1 - when: "not 'resources' in nodes or nodes.resources|length == 0" - name: generate talosconfig shell: cmd: talosctl gen config -t talosconfig -o talos/talosconfig-{{ talos_host.talos_cluster }} --with-secrets <(ansible-vault view talos/{{ talos_host.talos_cluster }}-secrets.yaml) {{ talos_host.talos_cluster }} {{ talos_clusters[talos_host.talos_cluster].endpoint }} --force chdir: "{{ inventory_dir }}" delegate_to: 127.0.0.1 - when: "not 'resources' in nodes or nodes.resources|length == 0" - name: set talosconfig endpoint shell: cmd: talosctl --talosconfig=talos/talosconfig-{{ talos_host.talos_cluster }} config endpoint {{ inventory_hostname }} chdir: "{{ inventory_dir }}" delegate_to: 127.0.0.1 + +- name: get kubeconfig + command: + cmd: talosctl kubeconfig --talosconfig talos/talosconfig-{{ talos_host.talos_cluster }} --nodes {{ inventory_hostname }} -f + chdir: "{{ inventory_dir }}" + delegate_to: 127.0.0.1 + throttle: 1 + +- name: check node ready + k8s_info: + context: "admin@{{ talos_host.talos_cluster }}" + kind: Node + wait: true + wait_condition: + status: True + type: Ready + delegate_to: 127.0.0.1 + register: nodes + ignore_errors: true + +- name: setup proxmox hosts + import_tasks: proxmox.yml + when: "'k8s_proxmox' in group_names and not 'resources' in nodes or nodes.resources|length == 0" + +- name: apply config + command: + cmd: talosctl apply-config --insecure --nodes {{ ip.stdout }} --file talos/host-{{ inventory_hostname }}.yaml + chdir: "{{ inventory_dir }}" + delegate_to: 127.0.0.1 when: "not 'resources' in nodes or nodes.resources|length == 0" - name: bootstrap cluster |
