system-config/playbooks/zuul/run-base-post.yaml
James E. Blair 4f9720e76e Run a gerrit container on review-dev01
This runs gerrit in a container on review-dev01 using podman.

Remove an unused web_server.py file that we found from copying it
from puppet to ansible.

Change-Id: I399d3cf8471bc8063022b0db0ff81718b2ee2941
2019-10-29 08:29:17 +09:00

105 lines
2.9 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') }}"
- name: Ensure bridge ARA log directories exist
file:
path: "{{ item }}"
state: directory
with_items:
- "{{ zuul.executor.log_root }}/bridge.openstack.org/ara-report"
- hosts: all
tasks:
- name: Create container log dir
file:
path: "/var/log/docker"
state: directory
become: true
- name: List podman containers
command: "podman ps -a --format '{{ '{{ .Names }}' }}'"
register: podman_containers
ignore_errors: true
become: true
- name: Save podman container logs
loop: "{{ podman_containers.stdout_lines | default([]) }}"
shell: "podman logs {{ item }} &> /var/log/docker/{{ item }}.txt"
args:
executable: /bin/bash
become: true
- name: List docker containers
command: "docker ps -a --format '{{ '{{ .Names }}' }}'"
register: docker_containers
ignore_errors: true
become: true
- name: Save docker container logs
loop: "{{ docker_containers.stdout_lines | default([]) }}"
shell: "docker logs {{ item }} &> /var/log/docker/{{ item }}.txt"
args:
executable: /bin/bash
become: true
- name: Open container logs permissions
file:
dest: /var/log/docker
mode: u=rwX,g=rX,o=rX
recurse: yes
become: yes
- include_role:
name: stage-output
- hosts: bridge.openstack.org
tasks:
- name: Set log directory
set_fact:
log_dir: "{{ zuul.executor.log_root }}/{{ inventory_hostname }}"
# 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
# Note we convert to a HTML report with the ara-report role
# below
- name: Collect testing ARA results
synchronize:
dest: "{{ log_dir }}/ara-report/ansible.sqlite"
mode: pull
src: "/var/cache/ansible/ara.sqlite"
verify_host: true
ignore_errors: true
- name: Collect ansible configuration
synchronize:
dest: "{{ log_dir }}/etc"
mode: pull
src: "/etc/ansible"
verify_host: true
rsync_opts:
- "--exclude=__pycache__"
ignore_errors: true
- hosts: localhost
tasks:
- name: Create bridge.o.o ARA report
include_role:
name: ara-report
vars:
ara_database_path: "{{ zuul.executor.log_root }}/bridge.openstack.org/ara-report/ansible.sqlite"
ara_report_path: "bridge.openstack.org/ara-report/"
ara_report_type: html