diff options
Diffstat (limited to 'resources/tools/testbed-setup')
3 files changed, 34 insertions, 12 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 1cd64351a8..ad4fb37681 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,29 +1,38 @@ --- # file: roles/cleanup/tasks/kill_containers.yaml -- name: Kill containers +- name: Kill Docker Containers block: - - name: Kill container - Get running Docker containers + - 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 + - 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 + rescue: + - name: Restart Docker Daemon + systemd: + name: "docker" + state: "restarted" + +- name: Kill LXC Containers + block: + - 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 + - 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!" + msg: "Kill LXC containers failed!"
\ No newline at end of file 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 a593fc7616..30a9f459b5 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 @@ -27,6 +27,7 @@ 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 c24b5e6a7f..53a65dd608 100644 --- a/resources/tools/testbed-setup/ansible/roles/cleanup/tasks/sut.yaml +++ b/resources/tools/testbed-setup/ansible/roles/cleanup/tasks/sut.yaml @@ -33,26 +33,38 @@ process: "vpp_echo" tags: kill-process + - name: Find file or dir - Core zip file + find: + paths: "/tmp/" + patterns: "*tar.lzo.lrz.xz*" + register: files_to_delete + tags: remove-file-dir + - name: Remove file or dir - Core zip file file: + path: "{{ item.path }}" state: absent - path: "/tmp/*tar.lzo.lrz.xz*" + with_items: "{{ files_to_delete.files }}" + tags: remove-file-dir + + - name: Find file or dir - Core dump file + find: + paths: "/tmp/" + patterns: "*core*" + register: files_to_delete tags: remove-file-dir - name: Remove file or dir - Core dump file file: + path: "{{ item.path }}" state: absent - path: "/tmp/*core*" + with_items: "{{ files_to_delete.files }}" 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: |