magnum/playbooks/container-builder-copy-logs.yaml
Spyros Trigazis 60c996d2b4 Changes in container builder
* do not log the login command
* change dockerhub creds
* fix reference of tag in the push images task
* add retries
* remove repository parameter
* pull fedora from docker.io
* name docker_image tasks for each kubernetes and magnum images
* drop async logs

Change-Id: Iead202bdf9d7d42d0b7e21bea73a298678be714b
Signed-off-by: Spyros Trigazis <spyridon.trigazis@cern.ch>
2018-12-15 22:28:49 +01:00

47 lines
1.9 KiB
YAML

- hosts: all
tasks:
- shell:
cmd: |
set +o errexit
mkdir -p logs
# copy system log
sudo cp -r /var/log logs/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 | sudo tee logs/syslog.txt > /dev/null
sudo journalctl --no-pager -u docker.service | sudo tee logs/docker.log > /dev/null
fi
# sudo config
# final memory usage and process list
ps -eo user,pid,ppid,lwp,%cpu,%mem,size,rss,cmd > logs/ps.txt
# docker related information
(docker info && docker system df && docker system df -v) > logs/docker-info.txt
# fix the permissions for logs folder
sudo chmod -R 777 logs
# rename files to .txt; this is so that when displayed via
# logs.openstack.org clicking results in the browser shows the
# files, rather than trying to send it to another app or make you
# download it, etc.
# firstly, rename all .log files to .txt files
for f in $(find logs -name "*.log"); do
sudo mv $f ${f/.log/.txt}
done
# Update symlinks to new file names
for f in $(find logs -name "*FAILED*"); do
sudo mv ${f} ${f}.gz
sudo ln -sf ${f#*/000_FAILED_}.gz ${f}.gz
done
# Compress all text logs
find logs -iname '*.txt' -execdir gzip -9 {} \+
find logs -iname '*.json' -execdir gzip -9 {} \+
executable: /bin/bash
chdir: "{{ zuul.project.src_dir }}"
- synchronize:
src: '{{ zuul.project.src_dir }}/logs'
dest: '{{ zuul.executor.log_root }}'
mode: pull
copy_links: true
verify_host: true