fix: add Loki template validation and resource debugging
Some checks failed
Deploy Cluster / Ansible (push) Has been cancelled
Deploy Cluster / Terraform (push) Has been cancelled

This commit is contained in:
2026-03-02 13:56:48 +00:00
parent fe3814e0e3
commit 71a1495fbc

View File

@@ -64,8 +64,22 @@
--namespace {{ observability_namespace }}
--version {{ loki_chart_version }}
--values /tmp/loki-values.yaml
register: loki_template
changed_when: false
- name: Show Loki template output (check for StatefulSet)
debug:
msg: "Loki template contains StatefulSet: {{ 'kind: StatefulSet' in loki_template.stdout }}"
when: "'kind: StatefulSet' not in loki_template.stdout"
- name: Fail if Loki template produces no StatefulSet
fail:
msg: |
Loki Helm template produces no StatefulSet. Check values configuration.
Template output (first 100 lines):
{{ loki_template.stdout.split('\n')[:100] | join('\n') }}
when: "'kind: StatefulSet' not in loki_template.stdout"
- name: Remove legacy Loki scalable workloads (if present)
command: >-
kubectl -n {{ observability_namespace }} delete
@@ -116,7 +130,7 @@
failed_when: false
changed_when: true
- name: Show Loki Helm install output
- name: Show Loki Helm install result
debug:
msg: |
Helm install rc: {{ loki_install.rc }}
@@ -124,7 +138,17 @@
{{ loki_install.stdout }}
Helm install stderr:
{{ loki_install.stderr }}
when: loki_install.rc != 0
- name: Show all Loki resources after install
command: kubectl -n {{ observability_namespace }} get all -l app.kubernetes.io/name=loki
register: loki_resources
changed_when: false
failed_when: false
- name: Debug Loki resources
debug:
msg: "{{ loki_resources.stdout }}"
when: loki_resources.stdout | length > 0
- name: Wait for Loki statefulset rollout
command: kubectl -n {{ observability_namespace }} rollout status statefulset/loki --timeout=10m