Use stage-output role in system-config-run

This simplifies log collection.

Change-Id: I754637115f8c7469efbc1856e88bbcb6fb83b4ce
Depends-On: https://review.openstack.org/634293
This commit is contained in:
James E. Blair 2019-01-30 13:56:43 -08:00
parent df6edc372a
commit 22ad414a86
2 changed files with 11 additions and 50 deletions

View File

@ -339,6 +339,15 @@
post-run: playbooks/zuul/run-base-post.yaml
vars:
install_ansible_ara_enable: true
zuul_copy_output: "{{ copy_output | combine(host_copy_output | default({})) }}"
stage_dir: "{{ ansible_user_dir }}/zuul-output"
copy_output:
'/var/log/syslog': logs_txt
'/var/log/messages': logs_txt
host-vars:
bridge.openstack.org:
host_copy_output:
'{{ zuul.project.src_dir }}/junit.xml': logs
- job:
name: system-config-run-base

View File

@ -16,43 +16,8 @@
- hosts: all
tasks:
- name: Set log directory
set_fact:
log_dir: "{{ zuul.executor.log_root }}/hosts/{{ inventory_hostname }}/logs"
- name: Create list of files to collect
set_fact:
_to_collect: []
- name: Check for /var/log/syslog (debuntu)
stat:
path: '/var/log/syslog'
register: _syslog
become: yes
- name: Collect syslog
set_fact:
_to_collect: '{{ _to_collect + [_syslog.stat.path] }}'
when: _syslog.stat.exists
- name: Check for /var/log/messages (rpmish)
stat:
path: '/var/log/messages'
register: _messages
become: yes
- name: Collect messages
set_fact:
_to_collect: '{{ _to_collect + [_messages.stat.path] }}'
when: _messages.stat.exists
- name: 'Collect logs for {{ inventory_hostname }}'
synchronize:
dest: "{{ log_dir }}/{{ item | basename }}"
mode: pull
src: "{{ item }}"
become: yes
loop: "{{ _to_collect }}"
- include_role:
name: stage-output
- hosts: bridge.openstack.org
tasks:
@ -60,19 +25,6 @@
set_fact:
log_dir: "{{ zuul.executor.log_root }}/hosts/{{ inventory_hostname }}"
- name: Register junit.xml file
stat:
path: "{{ zuul.project.src_dir }}/junit.xml"
register: _junit
- name: Collect testinfra logs
synchronize:
dest: "{{ zuul.executor.log_root }}"
mode: pull
src: "{{ zuul.project.src_dir }}/junit.xml"
verify_host: true
when: _junit.stat.exists|bool
# Because during the test we run ansible as root, we need
# to allow ourselves permissions to copy the results
- name: Open ARA results permissions