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
This commit is contained in:
parent
2571b2c90f
commit
e0c627d8a6
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user