From 3fa8c545d05d05b20e7f75a32ae055a8f0df04b1 Mon Sep 17 00:00:00 2001 From: Xavi Hernandez Date: Fri, 13 Oct 2023 10:30:21 +0000 Subject: [PATCH] Add monitoring to each executed test Signed-off-by: Xavi Hernandez --- playbooks/ansible/client-test.yml | 2 +- playbooks/ansible/roles/tests/tasks/run-test.yml | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/playbooks/ansible/client-test.yml b/playbooks/ansible/client-test.yml index f4346ab1..32bfc711 100644 --- a/playbooks/ansible/client-test.yml +++ b/playbooks/ansible/client-test.yml @@ -1,5 +1,5 @@ --- -- hosts: clients +- hosts: all become: yes become_method: sudo vars_files: diff --git a/playbooks/ansible/roles/tests/tasks/run-test.yml b/playbooks/ansible/roles/tests/tasks/run-test.yml index 6a83ecaa..805b5d08 100644 --- a/playbooks/ansible/roles/tests/tasks/run-test.yml +++ b/playbooks/ansible/roles/tests/tasks/run-test.yml @@ -5,18 +5,27 @@ line: "PREPARING {{ role }}" - name: Prepare test {{ role }} + when: inventory_hostname in groups['clients'] include_role: name: "{{ role }}" tasks_from: prepare/main.yml - name: Process test {{ role }} block: + - name: Start monitoring + include_role: + name: monitor + tasks_from: start.yml + vars: + name: "{{ role }}" + - name: Log test start time include_tasks: log.yml vars: line: "RUNNING {{ role }}" - name: Run test {{ role }} + when: inventory_hostname in groups['clients'] include_role: name: "{{ role }}" @@ -27,6 +36,7 @@ line: "RECOVERING {{ role }}" - name: Recover from failure of {{ role }} + when: inventory_hostname in groups['clients'] include_role: name: "{{ role }}" tasks_from: recover/main.yml @@ -41,7 +51,13 @@ vars: line: "FINISHED {{ role }}" + - name: Stop monitoring + include_role: + name: monitor + tasks_from: stop.yml + - name: Cleanup for {{ role }} + when: inventory_hostname in groups['clients'] include_role: name: "{{ role }}" tasks_from: cleanup/main.yml