system-config/playbooks/zuul/run-base-post.yaml
Ian Wienand 7e9229c86d
bootstrap-bridge: drop pip3 role, add venv
The pip3 role installs the latest upstream pip, overwriting the
packaged versions.  We would prefer to install things in
venv/virtualenvs moving forward to keep better isolation.

Unfortunately thanks to time the Bionic era packaged pip is so old
that it can't install anything modern like Ansible.  Thus we have to
squash installing Ansible into a separate venv into this change as
well.

Although the venv created by default on the Bionic host also has an
old pip, luckily we already worked around that in
I81fd268a9354685496a75e33a6f038a32b686352 which provides a create-venv
role that creates a fully updated venv for us.

To minimise other changes, this symlinks ansible/ansible-playbook into
/usr/local/bin.  On our current production bastion host this will make
a bit of a mess -- but we are looking at replacing that with a fresh
system soon.  The idea is that this new system will not be
bootstrapped with a globally installed Ansible, so we won't have
things lying around in multiple places.

Change-Id: I7551eb92bb6dc5918c367cc347f046ff562eab0c
2022-10-11 15:09:40 +11:00

83 lines
2.2 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: Generate ARA static report
command: /usr/ansible-venv/bin/ara-manage generate /root/.ara/static
become: yes
- name: Collect testing ARA results
synchronize:
dest: "{{ log_dir }}/ara-report"
mode: pull
src: "/root/.ara/static/"
verify_host: true
become: yes
ignore_errors: true
- name: Add ARA artifact
zuul_return:
data:
zuul:
artifacts:
- name: ARA report
url: "bridge.openstack.org/ara-report/"
- name: Collect ansible configuration
synchronize:
dest: "{{ log_dir }}/etc"
mode: pull
src: "/etc/ansible"
verify_host: true
rsync_opts:
- "--exclude=__pycache__"
ignore_errors: true