a5f5091897
This reverts commit b5e87e62f1
.
Change-Id: I839c0fb9811ce68e2949402f12aab1387d1a812e
27 lines
937 B
YAML
27 lines
937 B
YAML
- name: List containers
|
|
command: "{{ container_command }} ps -a --format '{{ '{{ .Names }}' }}'"
|
|
register: docker_containers
|
|
failed_when: false
|
|
|
|
- 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([]) }}"
|
|
# We can't use the default 'item' because roles may be used in
|
|
# higher level loops and 'item' could conflict in that case.
|
|
loop_control:
|
|
loop_var: zj_container_name
|
|
shell: "{{ container_command }} logs {{ zj_container_name }} &> {{ ansible_user_dir }}/zuul-output/logs/{{ container_command }}/{{ zj_container_name }}.txt"
|
|
args:
|
|
executable: /bin/bash
|
|
failed_when: false
|
|
|
|
- name: Open container logs permissions
|
|
file:
|
|
dest: "{{ ansible_user_dir }}/zuul-output/logs/{{ container_command }}"
|
|
mode: u=rwX,g=rX,o=rX
|
|
recurse: yes
|