From e0c627d8a6ce483d10ecf7c429cdb8d821bd872b Mon Sep 17 00:00:00 2001 From: Mohammed Naser Date: Thu, 9 Jan 2020 19:47:10 -0500 Subject: [PATCH] Switch to collect-container-logs This change switches the post bits to use a new centralized role to collect all container logs. Depends-On: https://review.opendev.org/701867 Change-Id: I9e982b37518c22e6d5358f7604ebc7f56b0626e3 --- playbooks/zuul/run-base-post.yaml | 45 +++++-------------------------- 1 file changed, 7 insertions(+), 38 deletions(-) diff --git a/playbooks/zuul/run-base-post.yaml b/playbooks/zuul/run-base-post.yaml index 57380ac970..c0fac34324 100644 --- a/playbooks/zuul/run-base-post.yaml +++ b/playbooks/zuul/run-base-post.yaml @@ -16,44 +16,13 @@ - hosts: all tasks: - - name: Create container log dir - file: - path: "/var/log/docker" - state: directory - become: true - - - name: List podman containers - command: "podman ps -a --format '{{ '{{ .Names }}' }}'" - register: podman_containers - ignore_errors: true - become: true - - - name: Save podman container logs - loop: "{{ podman_containers.stdout_lines | default([]) }}" - shell: "podman logs {{ item }} &> /var/log/docker/{{ item }}.txt" - args: - executable: /bin/bash - become: true - - - name: List docker containers - command: "docker ps -a --format '{{ '{{ .Names }}' }}'" - register: docker_containers - ignore_errors: true - become: true - - - name: Save docker 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: collect-container-logs + vars: + container_command: "{{ item }}" + loop: + - docker + - podman - include_role: name: stage-output