ansible-role-zuul/tests/collect-logs.yaml
OpenDev Sysadmins 8eccde32cf OpenDev Migration Patch
This commit was bulk generated and pushed by the OpenDev sysadmins
as a part of the Git hosting and code review systems migration
detailed in these mailing list posts:

http://lists.openstack.org/pipermail/openstack-discuss/2019-March/003603.html
http://lists.openstack.org/pipermail/openstack-discuss/2019-April/004920.html

Attempts have been made to correct repository namespaces and
hostnames based on simple pattern matching, but it's possible some
were updated incorrectly or missed entirely. Please reach out to us
via the contact information listed at https://opendev.org/ with any
questions you may have.
2019-04-19 19:52:08 +00:00

45 lines
1.2 KiB
YAML

- hosts: all
tasks:
- name: Setup logs directory fact
set_fact:
__log_dir: "{{ zuul_output_dir }}/logs/logs/var/log/journal"
- name: Ensure journald logs directory exists
file:
path: "{{ __log_dir }}"
state: directory
- name: Collect journald logs
shell: "sudo journalctl -u {{ item }}.service | tee {{ __log_dir }}/{{ item }}.service.log"
args:
creates: "{{ __log_dir }}/{{ item }}.service.log"
with_items:
- zuul-executor
- zuul-fingergw
- zuul-merger
- zuul-scheduler
- zuul-web
- name: Prepare zuul log files
become: yes
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
- /var/log/zuul
# 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