66 lines
1.6 KiB
YAML
66 lines
1.6 KiB
YAML
---
|
|
|
|
- name: Get Talos etcd status
|
|
delegate_to: "{{ talosctl_host }}"
|
|
ansible.builtin.command:
|
|
cmd: talosctl etcd status
|
|
changed_when: false
|
|
environment:
|
|
TALOSCONFIG: "{{ talosconfig }}"
|
|
register: _talosctl_etcd_status
|
|
failed_when: "_talosctl_etcd_status.rc not in [0,1]"
|
|
|
|
- name: Talosctl bootstrap
|
|
when: "_talosctl_etcd_status.rc == 1"
|
|
delegate_to: "{{ talosctl_host }}"
|
|
ansible.builtin.command:
|
|
cmd: talosctl bootstrap
|
|
changed_when: true
|
|
environment:
|
|
TALOSCONFIG: "{{ talosconfig }}"
|
|
notify: Talos wait for health
|
|
|
|
- name: Flush handlers
|
|
ansible.builtin.meta: flush_handlers
|
|
|
|
- name: Talosctl kubeconfig
|
|
delegate_to: "{{ talosctl_host }}"
|
|
ansible.builtin.command:
|
|
cmd: >-
|
|
talosctl kubeconfig
|
|
--force
|
|
changed_when: false
|
|
environment:
|
|
TALOSCONFIG: "{{ talosconfig }}"
|
|
KUBECONFIG: "{{ kubeconfig }}"
|
|
|
|
- name: Kubectl get ndoes
|
|
delegate_to: "{{ kubectl_host }}"
|
|
ansible.builtin.command:
|
|
cmd: kubectl get nodes
|
|
environment:
|
|
KUBECONFIG: "{{ kubeconfig }}"
|
|
register: _kubectl_get_nodes
|
|
changed_when: false
|
|
|
|
- name: Show Kubectl get nodes output
|
|
ansible.builtin.debug:
|
|
var: _kubectl_get_nodes.stdout_lines
|
|
|
|
#- name: Get nodes
|
|
# when: 'first_node | default(false)"
|
|
# delegate_to: "{{ kubectl_host }}"
|
|
# become: no
|
|
# kubernetes.core.k8s_info:
|
|
# kind: Node
|
|
# kubeconfig: "{{ kubeconfig }}"
|
|
# register: _k8s_nodes
|
|
|
|
#- name: Show nodes
|
|
# when: "first_node | default(false)"
|
|
# ansible.builtin.debug:
|
|
# msg: "{{ _k8s_node.metadata.name }}"
|
|
# loop: "{{ _k8s_nodes.resources }}"
|
|
# loop_control:
|
|
# loop_var: _k8s_node
|
|
# label: "{{ _k8s_node.metadata.name }}" |