d48667a3c5
Change-Id: I41718073962c8e7eb3d8810276e550fb84bd6e99
25 lines
835 B
YAML
25 lines
835 B
YAML
- hosts: all
|
|
tasks:
|
|
- name: List containers
|
|
command: "{{ container_command }} ps -a --format '{{ '{{ .Names }}' }}'"
|
|
register: docker_containers
|
|
ignore_errors: true
|
|
|
|
- name: Create container log dir
|
|
file:
|
|
path: "{{ ansible_user_dir }}/zuul-output/logs/{{ container_command }}"
|
|
state: directory
|
|
|
|
- name: Save container logs
|
|
loop: "{{ docker_containers.stdout_lines | default([]) }}"
|
|
shell: "{{ container_command }} logs {{ item }} &> {{ ansible_user_dir }}/zuul-output/logs/{{ container_command }}/{{ item }}.txt"
|
|
args:
|
|
executable: /bin/bash
|
|
ignore_errors: true
|
|
|
|
- name: Open container logs permissions
|
|
file:
|
|
dest: "{{ ansible_user_dir }}/zuul-output/logs/{{ container_command }}"
|
|
mode: u=rwX,g=rX,o=rX
|
|
recurse: yes
|