From b8e06ce97d82640528b2180de409e324b41f2fd7 Mon Sep 17 00:00:00 2001 From: pmikus Date: Wed, 7 Jun 2023 05:29:07 +0000 Subject: [PATCH] fix(ansible): Cleanup macros Signed-off-by: pmikus Change-Id: I53a530a07716e09b30b5401b313202460fb235c3 --- .../roles/cleanup/tasks/clean_images.yaml | 2 +- .../roles/cleanup/tasks/kill_containers.yaml | 10 +++++----- .../roles/cleanup/tasks/kill_process.yaml | 3 ++- fdio.infra.ansible/roles/cleanup/tasks/main.yaml | 19 +------------------ fdio.infra.ansible/roles/cleanup/tasks/nomad.yaml | 12 ++++-------- .../roles/cleanup/tasks/remove_package.yaml | 6 +++--- fdio.infra.ansible/roles/cleanup/tasks/sut.yaml | 2 +- fdio.infra.ansible/roles/cleanup/tasks/tg.yaml | 2 +- .../roles/cleanup/tasks/vpp_device.yaml | 2 +- 9 files changed, 19 insertions(+), 39 deletions(-) diff --git a/fdio.infra.ansible/roles/cleanup/tasks/clean_images.yaml b/fdio.infra.ansible/roles/cleanup/tasks/clean_images.yaml index f3778712bf..76704ab50d 100644 --- a/fdio.infra.ansible/roles/cleanup/tasks/clean_images.yaml +++ b/fdio.infra.ansible/roles/cleanup/tasks/clean_images.yaml @@ -1,5 +1,5 @@ --- -# file: roles/cleanup/tasks/clean_images.yaml +# file: tasks/clean_images.yaml - name: Clean Docker Images block: diff --git a/fdio.infra.ansible/roles/cleanup/tasks/kill_containers.yaml b/fdio.infra.ansible/roles/cleanup/tasks/kill_containers.yaml index 22239b1ebb..dc739eb954 100644 --- a/fdio.infra.ansible/roles/cleanup/tasks/kill_containers.yaml +++ b/fdio.infra.ansible/roles/cleanup/tasks/kill_containers.yaml @@ -1,16 +1,16 @@ --- -# file: roles/cleanup/tasks/kill_containers.yaml +# file: tasks/kill_containers.yaml - name: Kill Docker Containers block: - - name: Kill Container - Get Running Docker Containers + - name: Get Running Docker Containers ansible.builtin.shell: "docker ps -a --filter name=DUT -q" register: running_containers changed_when: false tags: - kill-containers - - name: Kill Container - Remove All Docker Containers + - name: Remove All Docker Containers ansible.builtin.shell: "docker rm --force {{ item }}" with_items: "{{ running_containers.stdout_lines }}" tags: @@ -24,14 +24,14 @@ - name: Kill LXC Containers block: - - name: Kill Container - Get Running LXC Containers + - name: Get Running LXC Containers ansible.builtin.shell: "lxc-ls" register: running_containers changed_when: false tags: - kill-containers - - name: Kill Container - Remove All LXC Containers + - name: Remove All LXC Containers ansible.builtin.shell: "lxc-destroy --force -n {{ item }}" with_items: "{{ running_containers.stdout_lines }}" tags: diff --git a/fdio.infra.ansible/roles/cleanup/tasks/kill_process.yaml b/fdio.infra.ansible/roles/cleanup/tasks/kill_process.yaml index bad5ef5e7c..9ab98a8e57 100644 --- a/fdio.infra.ansible/roles/cleanup/tasks/kill_process.yaml +++ b/fdio.infra.ansible/roles/cleanup/tasks/kill_process.yaml @@ -1,5 +1,5 @@ --- -# file: roles/cleanup/tasks/kill_process.yaml +# file: tasks/kill_process.yaml - name: Kill Process - {{ process }} block: @@ -14,6 +14,7 @@ - name: Safe Kill {{ process }} ansible.builtin.shell: "kill {{ item }}" with_items: "{{ running_processes.stdout_lines }}" + ignore_errors: true tags: - kill-process diff --git a/fdio.infra.ansible/roles/cleanup/tasks/main.yaml b/fdio.infra.ansible/roles/cleanup/tasks/main.yaml index eeda0139b3..c97b9c5d7e 100644 --- a/fdio.infra.ansible/roles/cleanup/tasks/main.yaml +++ b/fdio.infra.ansible/roles/cleanup/tasks/main.yaml @@ -1,22 +1,5 @@ --- -# file: roles/cleanup/tasks/main.yaml -# purpose: Structured per server cleanup tasks. -# - main: -# - tg: -# - Run tasks on TG servers only. -# - Cleanup processes (T-Rex). -# - sut: -# - Run tasks on SUT servers only. -# - Cleanup file leftovers (logs). -# - Cleanup packages (VPP, Honeycomb). -# - Cleanup processes (qemu, l3fwd, testpmd, docker, kubernetes) -# - Cleanup interfaces. -# - vpp_device -# - Run tasks on vpp_device servers only. -# - Reset SRIOV -# - Docker image cleanup -# - nomad -# - Docker image cleanup +# file: tasks/main.yaml - name: tg specific include_tasks: tg.yaml diff --git a/fdio.infra.ansible/roles/cleanup/tasks/nomad.yaml b/fdio.infra.ansible/roles/cleanup/tasks/nomad.yaml index 3d8f322840..086a4eff7d 100644 --- a/fdio.infra.ansible/roles/cleanup/tasks/nomad.yaml +++ b/fdio.infra.ansible/roles/cleanup/tasks/nomad.yaml @@ -1,5 +1,5 @@ --- -# file: roles/cleanup/tasks/nomad.yaml +# file: tasks/nomad.yaml - name: Host Cleanup block: @@ -8,15 +8,11 @@ vars: images_to_prefetch_by_arch: aarch64: + - "fdiotools/builder-ubuntu2204:prod-aarch64" - "fdiotools/builder-ubuntu2004:prod-aarch64" - - "fdiotools/builder-ubuntu1804:prod-aarch64" - - "fdiotools/builder-centos8:prod-aarch64" x86_64: + - "fdiotools/builder-ubuntu2204:prod-x86_64" - "fdiotools/builder-ubuntu2004:prod-x86_64" - - "fdiotools/builder-ubuntu1804:prod-x86_64" - - "fdiotools/builder-debian10:prod-x86_64" - - "fdiotools/builder-debian9:prod-x86_64" - - "fdiotools/builder-centos8:prod-x86_64" - - "fdiotools/builder-centos7:prod-x86_64" + - "fdiotools/builder-debian11:prod-x86_64" tags: - clean-images diff --git a/fdio.infra.ansible/roles/cleanup/tasks/remove_package.yaml b/fdio.infra.ansible/roles/cleanup/tasks/remove_package.yaml index 27a6785440..652729bc30 100644 --- a/fdio.infra.ansible/roles/cleanup/tasks/remove_package.yaml +++ b/fdio.infra.ansible/roles/cleanup/tasks/remove_package.yaml @@ -1,7 +1,7 @@ --- -# file: roles/cleanup/tasks/remove_package.yaml +# file: tasks/remove_package.yaml -- name: Remove Package - Fix Corrupted APT +- name: Fix Corrupted APT ansible.builtin.shell: "dpkg --configure -a" when: - ansible_distribution == 'Ubuntu' @@ -18,4 +18,4 @@ when: - ansible_distribution == 'Ubuntu' tags: - - remove-package + - remove-package \ No newline at end of file diff --git a/fdio.infra.ansible/roles/cleanup/tasks/sut.yaml b/fdio.infra.ansible/roles/cleanup/tasks/sut.yaml index 88926992b3..22bf596369 100644 --- a/fdio.infra.ansible/roles/cleanup/tasks/sut.yaml +++ b/fdio.infra.ansible/roles/cleanup/tasks/sut.yaml @@ -1,5 +1,5 @@ --- -# file: roles/cleanup/tasks/sut.yaml +# file: tasks/sut.yaml - name: Host Cleanup block: diff --git a/fdio.infra.ansible/roles/cleanup/tasks/tg.yaml b/fdio.infra.ansible/roles/cleanup/tasks/tg.yaml index fa2d2d2819..8c0162df2c 100644 --- a/fdio.infra.ansible/roles/cleanup/tasks/tg.yaml +++ b/fdio.infra.ansible/roles/cleanup/tasks/tg.yaml @@ -1,5 +1,5 @@ --- -# file: roles/cleanup/tasks/tg.yaml +# file: tasks/tg.yaml - name: Host Cleanup block: diff --git a/fdio.infra.ansible/roles/cleanup/tasks/vpp_device.yaml b/fdio.infra.ansible/roles/cleanup/tasks/vpp_device.yaml index f617c4dff5..c97fa0cde5 100644 --- a/fdio.infra.ansible/roles/cleanup/tasks/vpp_device.yaml +++ b/fdio.infra.ansible/roles/cleanup/tasks/vpp_device.yaml @@ -1,5 +1,5 @@ --- -# file: roles/cleanup/tasks/vpp_device.yaml +# file: tasks/vpp_device.yaml - name: Host Cleanup block: -- 2.16.6