python-tempestconf/playbooks/upload-logs.yaml
Arx Cruz 44a6513e5f Collecting tempest files
This patch collect the tempest.conf, accounts.yaml and the
tempest.log files. In order to make it work here's what had to
be changed:

* General refactor of the jobs
* Devstack jobs, inherited from devstack, and these files are on logs/
  since it's the only place we can specify files to be according
  zuul documentation. You could add a tempest directory in logs but
  we would have to overwrite a lot of code just for it, since we
  are inherit the tempest run playbook from tempest project.
* Packstack jobs are inherited from packstack, and they have a different
  way to upload logs, and they don't run tempest, so we had to
  implement our own upload logs and overwrite the packstack one.
  Basically a copy and paste, plus the generation of tempest directory
  in /tmp/logs and copying the files to that directory.
* Instead of use the copy module from ansible, we are using the
  command module doing a sudo cp file because the copy module was
  failing with file not found, even though the file was there.
  A bug was opened against ansible at
  https://github.com/ansible/ansible/issues/42198
* Removing local py35 job since we are inherit it from upstream already

Task: 22669
Story: 2002785

Change-Id: I04b0700955325fac543fb8410da5099872e9c7db
2018-07-03 06:48:00 -03:00

31 lines
859 B
YAML

- hosts: all
tasks:
- name: Create tempest directory in /tmp/logs
file:
path: /tmp/logs/tempest
state: directory
become: True
# Using command instead of copy due
# https://github.com/ansible/ansible/issues/42198
- name: Copying tempest logs and config to /tmp/logs/tempest
command: "sudo cp {{ item }} /tmp/logs/tempest"
with_items:
- /opt/stack/tempest/etc/tempest.conf
- /opt/stack/tempest/tempest.log
- /etc/openstack/accounts.yaml
ignore_errors: True
- name: Upload logs
synchronize:
src: '/tmp/logs'
dest: '{{ zuul.executor.log_root }}'
mode: pull
copy_links: true
verify_host: true
rsync_opts:
- --include=/logs/**
- --include=*/
- --exclude=*
- --prune-empty-dirs