From 87a0764cfb2a541484c3b36b52716579502410e1 Mon Sep 17 00:00:00 2001 From: Hongbin Lu Date: Mon, 2 Sep 2019 04:03:00 +0000 Subject: [PATCH] Fetch docker logs in post run Change-Id: If025a9d3f8e2708c1bebcb2419dd840b15cab79b --- .zuul.yaml | 2 ++ playbooks/fullstack/post.yaml | 3 +++ playbooks/zun-tempest-base/post.yaml | 14 ++------------ roles/fetch_docker_log/tasks/main.yaml | 11 +++++++++++ 4 files changed, 18 insertions(+), 12 deletions(-) create mode 100644 playbooks/fullstack/post.yaml create mode 100644 roles/fetch_docker_log/tasks/main.yaml diff --git a/.zuul.yaml b/.zuul.yaml index d0ef79092..862fae518 100644 --- a/.zuul.yaml +++ b/.zuul.yaml @@ -91,6 +91,7 @@ s-object: false s-container: false s-proxy: false + post-run: playbooks/zun-tempest-base/post.yaml - job: name: zun-tempest-multinode-docker-sql @@ -138,6 +139,7 @@ zun: https://opendev.org/openstack/zun kuryr-libnetwork: https://opendev.org/openstack/kuryr-libnetwork devstack-plugin-container: https://opendev.org/openstack/devstack-plugin-container + post-run: playbooks/fullstack/post.yaml - project: templates: diff --git a/playbooks/fullstack/post.yaml b/playbooks/fullstack/post.yaml new file mode 100644 index 000000000..f36f9453b --- /dev/null +++ b/playbooks/fullstack/post.yaml @@ -0,0 +1,3 @@ +- hosts: all + roles: + - fetch_docker_log diff --git a/playbooks/zun-tempest-base/post.yaml b/playbooks/zun-tempest-base/post.yaml index 3e2ff9293..f36f9453b 100644 --- a/playbooks/zun-tempest-base/post.yaml +++ b/playbooks/zun-tempest-base/post.yaml @@ -1,13 +1,3 @@ - hosts: all - tasks: - - name: Ensure {{ ansible_user_dir }}/logs exists - become: True - file: - path: "{{ ansible_user_dir }}/logs" - state: directory - owner: "{{ ansible_user }}" - - name: Copy over docker systemd unit journals - shell: - cmd: | - sudo journalctl -o short-precise --unit docker | sudo tee {{ ansible_user_dir }}/logs/docker.txt > /dev/null - executable: /bin/bash + roles: + - fetch_docker_log diff --git a/roles/fetch_docker_log/tasks/main.yaml b/roles/fetch_docker_log/tasks/main.yaml new file mode 100644 index 000000000..82942775e --- /dev/null +++ b/roles/fetch_docker_log/tasks/main.yaml @@ -0,0 +1,11 @@ +- name: Ensure {{ ansible_user_dir }}/logs exists + become: True + file: + path: "{{ ansible_user_dir }}/logs" + state: directory + owner: "{{ ansible_user }}" +- name: Copy over docker systemd unit journals + shell: + cmd: | + sudo journalctl -o short-precise --unit docker | sudo tee {{ ansible_user_dir }}/logs/docker.txt > /dev/null + executable: /bin/bash