summaryrefslogtreecommitdiff
path: root/playbooks/metal3-ci/fetch_kube_logs.yaml
diff options
context:
space:
mode:
Diffstat (limited to 'playbooks/metal3-ci/fetch_kube_logs.yaml')
-rw-r--r--playbooks/metal3-ci/fetch_kube_logs.yaml32
1 files changed, 32 insertions, 0 deletions
diff --git a/playbooks/metal3-ci/fetch_kube_logs.yaml b/playbooks/metal3-ci/fetch_kube_logs.yaml
new file mode 100644
index 000000000..a20294178
--- /dev/null
+++ b/playbooks/metal3-ci/fetch_kube_logs.yaml
@@ -0,0 +1,32 @@
+---
+- 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