Role for gathering container runtime logs
Change-Id: Ic380e36d1b15a31818b4eaa27e26e9283fc8bed0
This commit is contained in:
parent
3b7fdd8f6b
commit
98f0300921
|
@ -0,0 +1,32 @@
|
|||
- name: set runtime logs dir
|
||||
set_fact:
|
||||
runtime_logs_dir: "{{ logs_dir }}/{{ container_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: "'docker' in services"
|
||||
args:
|
||||
executable: /bin/bash
|
||||
ignore_errors: True
|
||||
become: true
|
||||
|
||||
- name: dump containerd logs
|
||||
shell: |-
|
||||
journalctl --unit "containerd" --no-pager > "{{ runtime_logs_dir }}/containerd.log"
|
||||
when: "'containerd' in services"
|
||||
args:
|
||||
executable: /bin/bash
|
||||
ignore_errors: True
|
||||
become: true
|
||||
|
||||
- name: "Downloads logs to executor"
|
||||
synchronize:
|
||||
src: "{{ runtime_logs_dir }}"
|
||||
dest: "{{ zuul.executor.log_root }}/{{ inventory_hostname }}"
|
||||
mode: pull
|
Loading…
Reference in New Issue