aboutsummaryrefslogtreecommitdiffstats
path: root/fdio.infra.ansible/roles/cleanup/tasks
diff options
context:
space:
mode:
Diffstat (limited to 'fdio.infra.ansible/roles/cleanup/tasks')
-rw-r--r--fdio.infra.ansible/roles/cleanup/tasks/clean_images.yaml6
-rw-r--r--fdio.infra.ansible/roles/cleanup/tasks/kill_containers.yaml20
-rw-r--r--fdio.infra.ansible/roles/cleanup/tasks/kill_process.yaml9
-rw-r--r--fdio.infra.ansible/roles/cleanup/tasks/main.yaml19
-rw-r--r--fdio.infra.ansible/roles/cleanup/tasks/nomad.yaml12
-rw-r--r--fdio.infra.ansible/roles/cleanup/tasks/remove_package.yaml10
-rw-r--r--fdio.infra.ansible/roles/cleanup/tasks/sut.yaml17
-rw-r--r--fdio.infra.ansible/roles/cleanup/tasks/tg.yaml2
-rw-r--r--fdio.infra.ansible/roles/cleanup/tasks/vpp_device.yaml4
9 files changed, 43 insertions, 56 deletions
diff --git a/fdio.infra.ansible/roles/cleanup/tasks/clean_images.yaml b/fdio.infra.ansible/roles/cleanup/tasks/clean_images.yaml
index 7558ee0fd7..76704ab50d 100644
--- a/fdio.infra.ansible/roles/cleanup/tasks/clean_images.yaml
+++ b/fdio.infra.ansible/roles/cleanup/tasks/clean_images.yaml
@@ -1,10 +1,10 @@
---
-# file: roles/cleanup/tasks/clean_images.yaml
+# file: tasks/clean_images.yaml
- name: Clean Docker Images
block:
- name: Clean Images - Prefetch Docker Images
- cron:
+ ansible.builtin.cron:
name: "Prefetch docker image {{ item }}"
minute: "10"
hour: "7"
@@ -15,7 +15,7 @@
- prefetch-docker-images
- name: Clean Images - Remove Dangling Docker Images
- cron:
+ ansible.builtin.cron:
name: "Remove dangling docker images"
minute: "10"
hour: "5"
diff --git a/fdio.infra.ansible/roles/cleanup/tasks/kill_containers.yaml b/fdio.infra.ansible/roles/cleanup/tasks/kill_containers.yaml
index 750572feb9..dc739eb954 100644
--- a/fdio.infra.ansible/roles/cleanup/tasks/kill_containers.yaml
+++ b/fdio.infra.ansible/roles/cleanup/tasks/kill_containers.yaml
@@ -1,38 +1,38 @@
---
-# file: roles/cleanup/tasks/kill_containers.yaml
+# file: tasks/kill_containers.yaml
- name: Kill Docker Containers
block:
- - name: Kill Container - Get Running Docker Containers
- shell: "docker ps -aq"
+ - 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
- shell: "docker rm --force {{ item }}"
+ - name: Remove All Docker Containers
+ ansible.builtin.shell: "docker rm --force {{ item }}"
with_items: "{{ running_containers.stdout_lines }}"
tags:
- kill-containers
rescue:
- name: Restart Docker Daemon
- systemd:
+ ansible.builtin.systemd:
name: "docker"
state: "restarted"
- name: Kill LXC Containers
block:
- - name: Kill Container - Get Running LXC Containers
- shell: "lxc-ls"
+ - 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
- shell: "lxc-destroy --force -n {{ item }}"
+ - name: Remove All LXC Containers
+ ansible.builtin.shell: "lxc-destroy --force -n {{ item }}"
with_items: "{{ running_containers.stdout_lines }}"
tags:
- kill-containers
diff --git a/fdio.infra.ansible/roles/cleanup/tasks/kill_process.yaml b/fdio.infra.ansible/roles/cleanup/tasks/kill_process.yaml
index d6c6ed5118..9ab98a8e57 100644
--- a/fdio.infra.ansible/roles/cleanup/tasks/kill_process.yaml
+++ b/fdio.infra.ansible/roles/cleanup/tasks/kill_process.yaml
@@ -1,10 +1,10 @@
---
-# file: roles/cleanup/tasks/kill_process.yaml
+# file: tasks/kill_process.yaml
- name: Kill Process - {{ process }}
block:
- name: Get PID Of {{ process }}
- shell: "ps -ef | grep -v grep | grep -w {{ process }} | awk '{print $2}'"
+ ansible.builtin.shell: "ps -ef | grep -v grep | grep -w {{ process }} | awk '{print $2}'"
when:
- process is defined and process != ""
register: running_processes
@@ -12,8 +12,9 @@
- kill-process
- name: Safe Kill {{ process }}
- shell: "kill {{ item }}"
+ ansible.builtin.shell: "kill {{ item }}"
with_items: "{{ running_processes.stdout_lines }}"
+ ignore_errors: true
tags:
- kill-process
@@ -27,7 +28,7 @@
- kill-process
- name: Kill Process - Force Kill {{ process }}
- shell: "kill -9 {{ item }}"
+ ansible.builtin.shell: "kill -9 {{ item }}"
with_items: "{{ killed_processes.results | select('failed') | map(attribute='item') | list }}"
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 484868e595..652729bc30 100644
--- a/fdio.infra.ansible/roles/cleanup/tasks/remove_package.yaml
+++ b/fdio.infra.ansible/roles/cleanup/tasks/remove_package.yaml
@@ -1,15 +1,15 @@
---
-# file: roles/cleanup/tasks/remove_package.yaml
+# file: tasks/remove_package.yaml
-- name: Remove Package - Fix Corrupted APT
- shell: "dpkg --configure -a"
+- name: Fix Corrupted APT
+ ansible.builtin.shell: "dpkg --configure -a"
when:
- ansible_distribution == 'Ubuntu'
tags:
- remove-package
- name: Remove Package - {{ package }}
- apt:
+ ansible.builtin.apt:
name: "{{ package }}"
force: true
purge: true
@@ -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 396e442b4e..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:
@@ -38,6 +38,13 @@
tags:
- kill-process
+ - name: Kill Processes - vpp
+ import_tasks: kill_process.yaml
+ vars:
+ process: "vpp"
+ tags:
+ - kill-process
+
- name: Kill Processes - vpp_echo
import_tasks: kill_process.yaml
vars:
@@ -46,7 +53,7 @@
- kill-process
- name: Find File Or Dir - Core Zip File
- find:
+ ansible.builtin.find:
paths: "/tmp/"
patterns: "*tar.lzo.lrz.xz*"
register: files_to_delete
@@ -54,7 +61,7 @@
- remove-file-dir
- name: Remove File Or Dir - Core Zip File
- file:
+ ansible.builtin.file:
path: "{{ item.path }}"
state: absent
with_items: "{{ files_to_delete.files }}"
@@ -62,7 +69,7 @@
- remove-file-dir
- name: Find File Or Dir - Core Dump File
- find:
+ ansible.builtin.find:
paths: "/tmp/"
patterns: "*core*"
register: files_to_delete
@@ -70,7 +77,7 @@
- remove-file-dir
- name: Remove File Or Dir - Core Dump File
- file:
+ ansible.builtin.file:
path: "{{ item.path }}"
state: absent
with_items: "{{ files_to_delete.files }}"
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 23d001fe6f..c97fa0cde5 100644
--- a/fdio.infra.ansible/roles/cleanup/tasks/vpp_device.yaml
+++ b/fdio.infra.ansible/roles/cleanup/tasks/vpp_device.yaml
@@ -1,10 +1,10 @@
---
-# file: roles/cleanup/tasks/vpp_device.yaml
+# file: tasks/vpp_device.yaml
- name: Host Cleanup
block:
- name: Reset vpp_device Binary
- copy:
+ ansible.builtin.copy:
src: "files/reset_vppdevice.sh"
dest: "/usr/local/bin"
owner: "root"