kolla/tests/playbooks/post.yml
Jan Gutter bd2b69e6f8 CI: fix podman info log collection
* capture podman config
* podman info needs sudo permissions
* before this fix, the podman info command failed with:
  Error: cannot set up namespace using "/usr/bin/newuidmap":
  should have setuid or have filecaps setuid: exit status 1

Change-Id: Ib3fe039a8c35421b56eedbd2d5197217b4a15a9a
2023-10-24 00:26:24 +01:00

77 lines
2.7 KiB
YAML

---
- hosts: all
tasks:
- name: Dump host info to logs
command: "{{ ansible_user_dir }}/{{ zuul.project.src_dir }}/tools/dump_info.sh"
args:
chdir: "{{ kolla_logs_dir }}"
- name: Collect various info to logs
shell:
cmd: |
set +o errexit
set -o xtrace
container_engine={{ container_engine }}
# copy system log
sudo cp -r /var/log system_log
if which journalctl ; then
# the journal gives us syslog() and kernel output, so is like
# a concatenation of the above.
sudo journalctl --no-pager > syslog.txt
sudo journalctl --no-pager -u {{ container_engine }}.service > {{ container_engine }}.log
else
# assume rsyslog
sudo cp /var/log/syslog syslog.txt
sudo cp /var/log/kern.log kern_log.txt
sudo cp /var/log/upstart/{{ container_engine }}.log {{ container_engine }}.log
fi
if [ "${container_engine}" == "docker" ]; then
if sudo test -d /var/lib/docker/volumes/kolla_logs/_data; then
sudo cp -r /var/lib/docker/volumes/kolla_logs/_data kolla_logs
fi
else
if sudo test -d /var/lib/containers/storage/volumes/kolla_logs/_data; then
sudo cp -r /var/lib/containers/storage/volumes/kolla_logs/_data kolla_logs
fi
fi
if sudo test -d /etc/containers; then
sudo cp -r /etc/containers etc_containers
fi
# sudo config
sudo cp -r /etc/sudoers.d ./
sudo cp /etc/sudoers sudoers.txt
df -h > df.txt
free > free.txt
sudo parted -l > parted-l.txt
mount > mount.txt
env > env.txt
if [ `command -v dpkg` ]; then
dpkg -l > dpkg-l.txt
fi
if [ `command -v rpm` ]; then
rpm -qa > rpm-qa.txt
fi
# final memory usage and process list
ps -eo user,pid,ppid,lwp,%cpu,%mem,size,rss,cmd > ps.txt
# docker related information
(sudo {{ container_engine }} info && sudo {{ container_engine }} system df && sudo {{ container_engine }} system df -v) > {{ container_engine }}-info.txt
sudo cp -r /etc/kolla kolla_configs
# last sudo to own all files
sudo chown -R {{ ansible_user_id }}: .
# Parse build logs and extract pkg install info
{{ ansible_user_dir }}/{{ zuul.project.src_dir }}/tests/files/process_build_logs.py -l build -b {{ base_distro }} > packages-info.txt
executable: /bin/bash
chdir: "{{ kolla_logs_dir }}"