system-config/playbooks/zuul/run-base-post.yaml
2020-09-10 01:18:54 +00:00

84 lines
2.4 KiB
YAML

- hosts: localhost
tasks:
- name: Make log directories for testing hosts
file:
path: "{{ zuul.executor.log_root }}/{{ item }}/logs"
state: directory
recurse: true
loop: "{{ query('inventory_hostnames', 'all') }}"
- hosts: all
tasks:
- include_role:
name: collect-container-logs
# The zuul user isn't part of the docker group on our fake
# production systems. Work around this by operating as root
# when collecting logs. This collects podman containers
# running as root; we may need to think about some flags for
# this role for collecting logs from containers under other
# users.
apply:
become: yes
vars:
container_command: "{{ item }}"
loop:
- docker
- podman
- include_role:
name: stage-output
- hosts: bridge.openstack.org
tasks:
- name: Set log directory
set_fact:
log_dir: "{{ zuul.executor.log_root }}/{{ inventory_hostname }}"
- name: Collect tox output
include_role:
name: fetch-tox-output
vars:
tox_envlist: testinfra
zuul_work_dir: src/opendev.org/opendev/system-config
# Because during the test we run ansible as root, we need
# to allow ourselves permissions to copy the results
- name: Open ARA results permissions
file:
dest: /var/cache/ansible
mode: u=rwX,g=rX,o=rX
recurse: yes
become: yes
- name: Ensure ARA log directories exist
file:
path: "{{ item }}"
state: directory
with_items:
- "{{ ansible_user_dir }}/zuul-output/logs/ara-report"
- name: Copy ARA database into report dir
copy:
remote_src: true
src: /var/cache/ansible/ara.sqlite
dest: "{{ ansible_user_dir }}/zuul-output/logs/ara-report/ara.sqlite"
- name: Create ARA report
include_role:
name: ara-report
vars:
ara_database_path: "{{ ansible_user_dir }}/zuul-output/logs/ara-report/ara.sqlite"
ara_report_path: "{{ ansible_user_dir }}/zuul-output/logs/ara-report/"
ara_report_type: html
ara_report_artifact_prefix: 'bridge.openstack.org/'
- name: Collect ansible configuration
synchronize:
dest: "{{ log_dir }}/etc"
mode: pull
src: "/etc/ansible"
verify_host: true
rsync_opts:
- "--exclude=__pycache__"
ignore_errors: true