Grab container logs at the end of run-base
So that we automatically get container logs for future jobs which use containers. Change-Id: I329c67eefb8c6a2ff9a8ce8ef69cc844cef6012a
This commit is contained in:
parent
22ad414a86
commit
8062f4c1ec
@ -344,6 +344,7 @@
|
||||
copy_output:
|
||||
'/var/log/syslog': logs_txt
|
||||
'/var/log/messages': logs_txt
|
||||
'/var/log/docker': logs
|
||||
host-vars:
|
||||
bridge.openstack.org:
|
||||
host_copy_output:
|
||||
|
@ -16,6 +16,32 @@
|
||||
|
||||
- hosts: all
|
||||
tasks:
|
||||
- name: List containers
|
||||
command: "docker ps -a --format '{{ '{{ .Names }}' }}'"
|
||||
register: docker_containers
|
||||
ignore_errors: true
|
||||
become: true
|
||||
|
||||
- name: Create container log dir
|
||||
file:
|
||||
path: "/var/log/docker"
|
||||
state: directory
|
||||
become: true
|
||||
|
||||
- name: Save 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
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user