Gather container runtime logs

Change-Id: I9d3bedd668a384c3baecb6ae1bd8404cd10baf1e
This commit is contained in:
Stanislav Egorov 2020-02-20 10:08:21 -08:00 committed by Stas Egorov
parent f66f94dc80
commit f681c373e2
2 changed files with 34 additions and 0 deletions

View File

@ -19,6 +19,7 @@
- gather-host-logs
- airship-gather-sushy-logs
- airship-gather-libvirt-logs
- airship-gather-runtime-logs
- airship-airshipctl-gather-configs
environment:
LIBVIRT_DEFAULT_URI: qemu:///system

View File

@ -0,0 +1,33 @@
- name: populate service facts
service_facts:
- name: set runtime logs dir
set_fact:
runtime_logs_dir: "{{ logs_dir }}/runtime"
- name: ensure directory for runtime logs exists
file:
state: directory
path: "{{ runtime_logs_dir }}"
- name: dump docker logs
shell: |-
journalctl --unit "docker" --no-pager > "{{ runtime_logs_dir }}/docker.log"
when: ansible_facts.services['docker'] is defined
args:
executable: /bin/bash
become: true
- name: dump containerd logs
shell: |-
journalctl --unit "containerd" --no-pager > "{{ runtime_logs_dir }}/containerd.log"
when: ansible_facts.services['containerd'] is defined
args:
executable: /bin/bash
become: true
- name: "Downloads logs to executor"
synchronize:
src: "{{ runtime_logs_dir }}"
dest: "{{ zuul.executor.log_root }}/{{ inventory_hostname }}"
mode: pull