diff --git a/roles/airship-gather-runtime-logs/tasks/main.yml b/roles/airship-gather-runtime-logs/tasks/main.yml new file mode 100644 index 0000000..5abea0f --- /dev/null +++ b/roles/airship-gather-runtime-logs/tasks/main.yml @@ -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