ironic/playbooks/metal3-ci/fetch_kube_logs.yaml
Dmitry Tantsur a6d87a608c Add a non-voting metal3 CI job
We'll use only one node as we're limited in resources but that
should suffice for a basic test.

Change-Id: I8e845d46ba0e13027aa1e628b0ad45eb24f9b387
2023-03-06 12:16:27 +01:00

33 lines
881 B
YAML

---
- name: Create the target directory
file:
path: "{{ logs_management_cluster }}/{{ namespace }}"
state: directory
- name: Fetch pods list
command: kubectl get pods -n "{{ namespace }}" -o json
ignore_errors: true
register: pods_result
- block:
- name: Save the pods list
copy:
dest: "{{ logs_management_cluster }}/{{ namespace }}/pods.yaml"
content: "{{ pods_result.stdout }}"
- name: Set pod names
set_fact:
pods: "{{ pods_result.stdout | from_json | json_query('items[*].metadata.name') }}"
- include_tasks: fetch_pod_logs.yaml
loop: "{{ pods }}"
loop_control:
loop_var: pod
when: pods_result is succeeded
- name: Fetch secrets
shell: |
kubectl get secrets -n "{{ namespace }}" -o yaml \
> "{{ logs_management_cluster }}/{{ namespace }}/secrets.yaml"
ignore_errors: true