nodepool-functional : ignore errors copying logs

If the job stops before the required directories here are created we
get a failure copying, which stops us collecting things that may be
useful to diagnosing the error.  Put the copying in a block that
ignores errors.

Also just copy the /var/log/syslog -- I think this came in originally
from something running on CentOS which doesn't have this, but now we
run on Ubuntu hosts and syslog has interesting things for diagnosing
errors.

Change-Id: Iaca4801a652ef4a67772c804271ea5c1db377051
This commit is contained in:
Ian Wienand 2021-04-20 14:17:54 +10:00 committed by Clark Boylan
parent 82cd35f9dd
commit 4689a7d938
2 changed files with 64 additions and 83 deletions

View File

@ -2,49 +2,39 @@
roles:
- collect-container-logs
tasks:
- name: Copy nodepool log files
synchronize:
src: /var/log/nodepool
dest: '{{ zuul.executor.log_root }}'
mode: pull
- name: Copy nodepool config files
synchronize:
src: /etc/nodepool
dest: '{{ zuul.executor.log_root }}'
mode: pull
- name: Copy instance console logs
become: true
synchronize:
src: /opt/stack/data/nova/instances
dest: '{{ zuul.executor.log_root }}'
mode: pull
rsync_opts:
- "--include=*/"
- "--include=console.log"
- "--exclude=*"
- name: Export legacy syslog.txt
become: true
shell:
# The journal contains everything running under systemd, we'll
# build an old school version of the syslog with just the
# kernel and sudo messages.
cmd: |
journalctl \
-t kernel \
-t sudo \
--no-pager \
| gzip - > {{ ansible_user_dir }}/syslog.txt.gz
- name: Copy nodepool logs
ignore_errors: yes
block:
- name: Copy nodepool log files
synchronize:
src: /var/log/nodepool
dest: '{{ zuul.executor.log_root }}'
mode: pull
- name: Copy nodepool config files
synchronize:
src: /etc/nodepool
dest: '{{ zuul.executor.log_root }}'
mode: pull
- name: Copy instance console logs
become: true
synchronize:
src: /opt/stack/data/nova/instances
dest: '{{ zuul.executor.log_root }}'
mode: pull
rsync_opts:
- "--include=*/"
- "--include=console.log"
- "--exclude=*"
- name: Copy syslog
become: True
synchronize:
src: "/var/log/syslog"
dest: '{{ zuul.executor.log_root }}'
mode: pull
- name: Copy syslog
become: True
synchronize:
src: "{{ ansible_user_dir }}/syslog.txt.gz"
dest: '{{ zuul.executor.log_root }}'
mode: pull
- name: Copy docker logs
become: True
synchronize:
src: '{{ ansible_user_dir }}/zuul-output/logs/docker'
dest: '{{ zuul.executor.log_root }}'
mode: pull
- name: Copy docker logs
become: True
synchronize:
src: '{{ ansible_user_dir }}/zuul-output/logs/docker'
dest: '{{ zuul.executor.log_root }}'
mode: pull

View File

@ -1,40 +1,31 @@
- hosts: all
tasks:
- name: Copy nodepool log files
synchronize:
src: /var/log/nodepool
dest: '{{ zuul.executor.log_root }}'
mode: pull
- name: Copy nodepool config files
synchronize:
src: /etc/nodepool
dest: '{{ zuul.executor.log_root }}'
mode: pull
- name: Copy instance console logs
become: true
synchronize:
src: /opt/stack/data/nova/instances
dest: '{{ zuul.executor.log_root }}'
mode: pull
rsync_opts:
- "--include=*/"
- "--include=console.log"
- "--exclude=*"
- name: Export legacy syslog.txt
become: true
shell:
# The journal contains everything running under systemd, we'll
# build an old school version of the syslog with just the
# kernel and sudo messages.
cmd: |
journalctl \
-t kernel \
-t sudo \
--no-pager \
| gzip - > {{ ansible_user_dir }}/syslog.txt.gz
- name: Copy syslog
become: True
synchronize:
src: "{{ ansible_user_dir }}/syslog.txt.gz"
dest: '{{ zuul.executor.log_root }}'
mode: pull
- name: Copy logs
ignore_errors: yes
block:
- name: Copy nodepool log files
synchronize:
src: /var/log/nodepool
dest: '{{ zuul.executor.log_root }}'
mode: pull
- name: Copy nodepool config files
synchronize:
src: /etc/nodepool
dest: '{{ zuul.executor.log_root }}'
mode: pull
- name: Copy instance console logs
become: true
synchronize:
src: /opt/stack/data/nova/instances
dest: '{{ zuul.executor.log_root }}'
mode: pull
rsync_opts:
- "--include=*/"
- "--include=console.log"
- "--exclude=*"
- name: Copy syslog
become: True
synchronize:
src: "/var/log/syslog"
dest: '{{ zuul.executor.log_root }}'
mode: pull