ansible-role-statsd/tests/collect-logs.yaml
Paul Belanger 1e5c3995e1
Initial commit
Change-Id: I2b63a94e622cbb48b3feb247c73f822a9500c36b
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
2018-03-22 20:47:11 -04:00

41 lines
1.1 KiB
YAML

- hosts: localhost
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"
- hosts: all
tasks:
- 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:
- statsd
- name: Collect journald log files
synchronize:
dest: "{{ zuul.executor.log_root }}/logs/var/log"
mode: pull
src: "~/logs/journal"
verify_host: true
- name: Collect statsd log files
synchronize:
dest: "{{ zuul.executor.log_root }}/logs"
mode: pull
rsync_opts:
- "--relative"
src: /var/log/statsd
verify_host: true