ansible-role-zuul/tests/collect-logs.yaml
Paul Belanger 9167794c34
Add support to manage SSL cert
Since gear support SSL certs, add in some support to place them into
the SSL folder.  It is possible we might want to move this into an
ansible role, but for now it seems minimal to support it.

Change-Id: I5a3097a6026f648c6dbabb1e26e6a4d201f68c1c
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
2018-04-03 22:36:28 -04:00

48 lines
1.3 KiB
YAML

- hosts: all
tasks:
- name: Ensure logs directory exists
file:
path: "{{ item }}"
state: directory
with_items:
- "{{ zuul.executor.log_root }}/logs"
- "{{ zuul.executor.log_root }}/logs/var/log"
delegate_to: localhost
- name: Ensure journald logs directory exists
file:
path: ~/logs/journal
state: directory
- name: Collect journald logs
become: yes
shell: "journalctl -u {{ item }}.service > /home/{{ ansible_user }}/logs/journal/{{ item }}.service.log"
args:
creates: "/home/{{ ansible_user }}/logs/journal/{{ item }}.service.log"
with_items:
- zuul-executor
- zuul-fingergw
- zuul-merger
- zuul-scheduler
- zuul-web
- name: Collect journald log files
synchronize:
dest: "{{ zuul.executor.log_root }}/logs/var/log"
mode: pull
src: ~/logs/journal
verify_host: true
- name: Collect zuul log files
synchronize:
dest: "{{ zuul.executor.log_root }}/logs"
mode: pull
recursive: false
rsync_opts:
- "--relative"
src: "{{ item }}"
verify_host: true
with_items:
- /etc/zuul/*
- /var/log/zuul/*