ansible-role-zuul-registry/tests/collect-logs.yaml
Paul Belanger aaf03fda0d Initial commit for ansible-role-zuul-registry
Depends-On: https://review.opendev.org/763098/
Change-Id: Icf7cd02a91372ec7d8a0843f08dbc4c9d45914cc
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
2020-11-19 19:46:10 -05:00

37 lines
1.1 KiB
YAML

---
- hosts: all
tasks:
- name: Ensure journald logs directory exists
file:
path: "{{ zuul_output_dir }}/logs/logs/var/log/journal"
state: directory
- name: Collect journald logs
shell: "sudo journalctl -u {{ item }}.service | tee {{ zuul_output_dir }}/logs/logs/var/log/journal/{{ item }}.service.log"
args:
creates: "{{ zuul_output_dir }}/logs/logs/var/log/journal/{{ item }}.service.log"
with_items:
- zuul-registry
- name: Prepare zuul-registry log files
become: true
synchronize:
dest: "{{ zuul_output_dir }}/logs/logs"
rsync_opts:
- "--relative"
- "--chown={{ ansible_user_id }}:{{ ansible_user_id }}"
src: "{{ item }}"
verify_host: true
delegate_to: "{{ inventory_hostname }}"
with_items:
- /etc/zuul-registry
# TODO: Migrate to fetch-zuul-logs when
# https://review.opendev.org/#/c/583346/ is merged.
- name: Collect log output
synchronize:
dest: "{{ zuul.executor.log_root }}/"
mode: pull
src: "{{ zuul_output_dir }}/logs/"
verify_host: true