fix: increase k3s readiness timeout and emit diagnostics on failure
This commit is contained in:
@@ -38,10 +38,35 @@
|
||||
command: "{{ (k3s_primary | default(false)) | ternary('kubectl get nodes', 'systemctl is-active k3s') }}"
|
||||
register: k3s_ready
|
||||
until: k3s_ready.rc == 0
|
||||
retries: 30
|
||||
retries: 120
|
||||
delay: 10
|
||||
changed_when: false
|
||||
|
||||
- name: Show k3s service status on failure
|
||||
command: systemctl status k3s --no-pager
|
||||
register: k3s_status
|
||||
changed_when: false
|
||||
failed_when: false
|
||||
when: k3s_ready is failed
|
||||
|
||||
- name: Show recent k3s logs on failure
|
||||
command: journalctl -u k3s -n 80 --no-pager
|
||||
register: k3s_journal
|
||||
changed_when: false
|
||||
failed_when: false
|
||||
when: k3s_ready is failed
|
||||
|
||||
- name: Fail with k3s diagnostics
|
||||
fail:
|
||||
msg: |
|
||||
k3s failed to become ready on {{ inventory_hostname }}.
|
||||
Service status:
|
||||
{{ k3s_status.stdout | default('n/a') }}
|
||||
|
||||
Recent logs:
|
||||
{{ k3s_journal.stdout | default('n/a') }}
|
||||
when: k3s_ready is failed
|
||||
|
||||
- name: Copy kubeconfig to default location for root
|
||||
file:
|
||||
src: /etc/rancher/k3s/k3s.yaml
|
||||
|
||||
Reference in New Issue
Block a user