aboutsummaryrefslogtreecommitdiffstats
path: root/resources/tools/testbed-setup/ansible/roles/cleanup
diff options
context:
space:
mode:
Diffstat (limited to 'resources/tools/testbed-setup/ansible/roles/cleanup')
-rw-r--r--resources/tools/testbed-setup/ansible/roles/cleanup/tasks/kill_containers.yaml41
-rw-r--r--resources/tools/testbed-setup/ansible/roles/cleanup/tasks/kill_process.yaml47
-rw-r--r--resources/tools/testbed-setup/ansible/roles/cleanup/tasks/sut.yaml112
3 files changed, 106 insertions, 94 deletions
diff --git a/resources/tools/testbed-setup/ansible/roles/cleanup/tasks/kill_containers.yaml b/resources/tools/testbed-setup/ansible/roles/cleanup/tasks/kill_containers.yaml
index 20306100e6..1cd64351a8 100644
--- a/resources/tools/testbed-setup/ansible/roles/cleanup/tasks/kill_containers.yaml
+++ b/resources/tools/testbed-setup/ansible/roles/cleanup/tasks/kill_containers.yaml
@@ -1,24 +1,29 @@
---
# file: roles/cleanup/tasks/kill_containers.yaml
-- name: Kill container - Get running Docker containers
- shell: "docker ps -aq"
- register: running_containers
- changed_when: no
- tags: kill-containers
+- name: Kill containers
+ block:
+ - name: Kill container - Get running Docker containers
+ shell: "docker ps -aq"
+ register: running_containers
+ changed_when: no
+ tags: kill-containers
-- name: Kill container - Remove all Docker containers
- shell: "docker rm --force {{ item }}"
- with_items: "{{ running_containers.stdout_lines }}"
- tags: kill-containers
+ - name: Kill container - Remove all Docker containers
+ shell: "docker rm --force {{ item }}"
+ with_items: "{{ running_containers.stdout_lines }}"
+ tags: kill-containers
-- name: Kill container - Get running LXC containers
- shell: "lxc-ls"
- register: running_containers
- changed_when: no
- tags: kill-containers
+ - name: Kill container - Get running LXC containers
+ shell: "lxc-ls"
+ register: running_containers
+ changed_when: no
+ tags: kill-containers
-- name: Kill container - Remove all LXC containers
- shell: "lxc-destroy --force -n {{ item }}"
- with_items: "{{ running_containers.stdout_lines }}"
- tags: kill-containers
+ - name: Kill container - Remove all LXC containers
+ shell: "lxc-destroy --force -n {{ item }}"
+ with_items: "{{ running_containers.stdout_lines }}"
+ tags: kill-containers
+ rescue:
+ - fail:
+ msg: "Kill containers failed!"
diff --git a/resources/tools/testbed-setup/ansible/roles/cleanup/tasks/kill_process.yaml b/resources/tools/testbed-setup/ansible/roles/cleanup/tasks/kill_process.yaml
index 4a1180b77f..a593fc7616 100644
--- a/resources/tools/testbed-setup/ansible/roles/cleanup/tasks/kill_process.yaml
+++ b/resources/tools/testbed-setup/ansible/roles/cleanup/tasks/kill_process.yaml
@@ -1,27 +1,32 @@
---
# file: roles/cleanup/tasks/kill_process.yaml
-- name: Kill process - Get pid of {{ process }}
- shell: "ps -ef | grep -v grep | grep -w {{ process }} | awk '{print $2}'"
- when: >
- process is defined and process != ""
- register: running_processes
- tags: kill-process
+- name: Kill process - {{ process }}
+ block:
+ - name: Kill process - Get pid of {{ process }}
+ shell: "ps -ef | grep -v grep | grep -w {{ process }} | awk '{print $2}'"
+ when: >
+ process is defined and process != ""
+ register: running_processes
+ tags: kill-process
-- name: Kill process - Safe kill {{ process }}
- shell: "kill {{ item }}"
- with_items: "{{ running_processes.stdout_lines }}"
- tags: kill-process
+ - name: Kill process - Safe kill {{ process }}
+ shell: "kill {{ item }}"
+ with_items: "{{ running_processes.stdout_lines }}"
+ tags: kill-process
-- wait_for:
- path: "/proc/{{ item }}/status"
- state: absent
- with_items: "{{ running_processes.stdout_lines }}"
- ignore_errors: yes
- register: killed_processes
- tags: kill-process
+ - wait_for:
+ path: "/proc/{{ item }}/status"
+ state: absent
+ with_items: "{{ running_processes.stdout_lines }}"
+ ignore_errors: yes
+ register: killed_processes
+ tags: kill-process
-- name: Kill process - Force kill {{ process }}
- shell: "kill -9 {{ item }}"
- with_items: "{{ killed_processes.results | select('failed') | map(attribute='item') | list }}"
- tags: kill-process
+ - name: Kill process - Force kill {{ process }}
+ shell: "kill -9 {{ item }}"
+ with_items: "{{ killed_processes.results | select('failed') | map(attribute='item') | list }}"
+ tags: kill-process
+ rescue:
+ - fail:
+ msg: "Kill process {{ process }} failed!"
diff --git a/resources/tools/testbed-setup/ansible/roles/cleanup/tasks/sut.yaml b/resources/tools/testbed-setup/ansible/roles/cleanup/tasks/sut.yaml
index b3f8fffea2..c24b5e6a7f 100644
--- a/resources/tools/testbed-setup/ansible/roles/cleanup/tasks/sut.yaml
+++ b/resources/tools/testbed-setup/ansible/roles/cleanup/tasks/sut.yaml
@@ -1,58 +1,60 @@
---
# file: roles/cleanup/tasks/sut.yaml
-- name: Kill processes - qemu
- import_tasks: kill_process.yaml
- vars:
- process: "qemu"
- tags: kill-process
-
-- name: Kill processes - l3fwd
- import_tasks: kill_process.yaml
- vars:
- process: "l3fwd"
- tags: kill-process
-
-- name: Kill processes - testpmd
- import_tasks: kill_process.yaml
- vars:
- process: "testpmd"
- tags: kill-process
-
-- name: Kill processes - iperf3
- import_tasks: kill_process.yaml
- vars:
- process: "iperf3"
- tags: kill-process
-
-- name: Kill processes - vpp_echo
- import_tasks: kill_process.yaml
- vars:
- process: "vpp_echo"
- tags: kill-process
-
-- name: Remove file or dir - Core zip file
- file:
- state: absent
- path: "/tmp/*tar.lzo.lrz.xz*"
- tags: remove-file-dir
-
-- name: Remove file or dir - Core dump file
- file:
- state: absent
- path: "/tmp/*core*"
- tags: remove-file-dir
-
-- name: Kill containers - Remove all containers
- import_tasks: kill_containers.yaml
- tags: kill-containers
-
-- name: Kubernetes - Reset
- raw: 'kubeadm reset --force'
- tags: kill-kubernetes
-
-- name: Remove packages - Remove VPP
- import_tasks: remove_package.yaml
- vars:
- package: "*vpp*"
- tags: remove-package
+- name: Host cleanup
+ block:
+ - name: Kill processes - qemu
+ import_tasks: kill_process.yaml
+ vars:
+ process: "qemu"
+ tags: kill-process
+
+ - name: Kill processes - l3fwd
+ import_tasks: kill_process.yaml
+ vars:
+ process: "l3fwd"
+ tags: kill-process
+
+ - name: Kill processes - testpmd
+ import_tasks: kill_process.yaml
+ vars:
+ process: "testpmd"
+ tags: kill-process
+
+ - name: Kill processes - iperf3
+ import_tasks: kill_process.yaml
+ vars:
+ process: "iperf3"
+ tags: kill-process
+
+ - name: Kill processes - vpp_echo
+ import_tasks: kill_process.yaml
+ vars:
+ process: "vpp_echo"
+ tags: kill-process
+
+ - name: Remove file or dir - Core zip file
+ file:
+ state: absent
+ path: "/tmp/*tar.lzo.lrz.xz*"
+ tags: remove-file-dir
+
+ - name: Remove file or dir - Core dump file
+ file:
+ state: absent
+ path: "/tmp/*core*"
+ tags: remove-file-dir
+
+ - name: Kill containers - Remove all containers
+ import_tasks: kill_containers.yaml
+ tags: kill-containers
+
+ - name: Kubernetes - Reset
+ raw: 'kubeadm reset --force'
+ tags: kill-kubernetes
+
+ - name: Remove packages - Remove VPP
+ import_tasks: remove_package.yaml
+ vars:
+ package: "*vpp*"
+ tags: remove-package