Role for gathering container runtime logs

Change-Id: Ic380e36d1b15a31818b4eaa27e26e9283fc8bed0
This commit is contained in:
Stanislav Egorov 2020-02-10 10:02:30 -08:00
parent 3b7fdd8f6b
commit 9b399bbf00
1 changed files with 26 additions and 0 deletions

View File

@ -0,0 +1,26 @@
- name: set container runtime
set_fact:
container_runtime: "docker"
- 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 runtime logs
shell: |-
journalctl --unit "{{ container_runtime }}.service" --no-pager > "{{ runtime_logs_dir }}/{{ container_runtime }}.log"
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