diff options
Diffstat (limited to 'resources/tools/testbed-setup/ansible/roles/cleanup/tasks')
9 files changed, 0 insertions, 329 deletions
diff --git a/resources/tools/testbed-setup/ansible/roles/cleanup/tasks/clean_images.yaml b/resources/tools/testbed-setup/ansible/roles/cleanup/tasks/clean_images.yaml deleted file mode 100644 index e030acbff2..0000000000 --- a/resources/tools/testbed-setup/ansible/roles/cleanup/tasks/clean_images.yaml +++ /dev/null @@ -1,36 +0,0 @@ ---- -# file: roles/cleanup/tasks/clean_images.yaml - -- name: Clean Docker Images - block: - - name: Clean Images - Prefetch Docker Images - cron: - name: "Prefetch docker image {{ item }}" - minute: "10" - hour: "7" - job: "/usr/bin/docker pull {{ item }}" - loop: - "{{ images_to_prefetch_by_arch[ansible_machine] }}" - tags: - - prefetch-docker-images - - - name: Clean Images - Remove Dangling Docker Images - cron: - name: "Remove dangling docker images" - minute: "10" - hour: "5" - weekday: "7" - job: "/usr/bin/docker rmi $(/usr/bin/docker images --filter 'dangling=true' -q)" - tags: - - remove-docker-images-dangling - - # TODO: Disabled until all images will be in registry - #- name: Clean Images - Prune Docker Images - # cron: - # name: "Prune docker images" - # minute: "10" - # hour: "6" - # weekday: 7 - # job: "/usr/bin/docker image prune --all --force" - # tags: - # - prune-docker-images
\ No newline at end of file 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 deleted file mode 100644 index 25fd48e420..0000000000 --- a/resources/tools/testbed-setup/ansible/roles/cleanup/tasks/kill_containers.yaml +++ /dev/null @@ -1,42 +0,0 @@ ---- -# file: roles/cleanup/tasks/kill_containers.yaml - -- name: Kill Docker 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 - - 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 - shell: "lxc-destroy --force -n {{ item }}" - with_items: "{{ running_containers.stdout_lines }}" - tags: - - kill-containers - - rescue: - - fail: - 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 deleted file mode 100644 index c7cee37485..0000000000 --- a/resources/tools/testbed-setup/ansible/roles/cleanup/tasks/kill_process.yaml +++ /dev/null @@ -1,37 +0,0 @@ ---- -# file: roles/cleanup/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}'" - when: - - process is defined and process != "" - register: running_processes - tags: - - kill-process - - - name: 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 - - - 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/main.yaml b/resources/tools/testbed-setup/ansible/roles/cleanup/tasks/main.yaml deleted file mode 100644 index eeda0139b3..0000000000 --- a/resources/tools/testbed-setup/ansible/roles/cleanup/tasks/main.yaml +++ /dev/null @@ -1,43 +0,0 @@ ---- -# 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 - -- name: tg specific - include_tasks: tg.yaml - when: "'tg' in group_names" - tags: - - cleanup - -- name: sut specific - include_tasks: sut.yaml - when: "'sut' in group_names" - tags: - - cleanup - -- name: vpp_device specific - include_tasks: vpp_device.yaml - when: "'vpp_device' in group_names" - tags: - - cleanup - -- name: nomad specific - include_tasks: nomad.yaml - when: "'nomad' in group_names" - tags: - - cleanup diff --git a/resources/tools/testbed-setup/ansible/roles/cleanup/tasks/nomad.yaml b/resources/tools/testbed-setup/ansible/roles/cleanup/tasks/nomad.yaml deleted file mode 100644 index 3c5bf6462d..0000000000 --- a/resources/tools/testbed-setup/ansible/roles/cleanup/tasks/nomad.yaml +++ /dev/null @@ -1,22 +0,0 @@ ---- -# file: roles/cleanup/tasks/nomad.yaml - -- name: Host Cleanup - block: - - name: Clean Images - import_tasks: clean_images.yaml - vars: - images_to_prefetch_by_arch: - aarch64: - - "fdiotools/builder-ubuntu2004:prod-aarch64" - - "fdiotools/builder-ubuntu1804:prod-aarch64" - - "fdiotools/builder-centos8:prod-aarch64" - 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" - tags: - - clean-images
\ No newline at end of file diff --git a/resources/tools/testbed-setup/ansible/roles/cleanup/tasks/remove_package.yaml b/resources/tools/testbed-setup/ansible/roles/cleanup/tasks/remove_package.yaml deleted file mode 100644 index 302b43c99a..0000000000 --- a/resources/tools/testbed-setup/ansible/roles/cleanup/tasks/remove_package.yaml +++ /dev/null @@ -1,21 +0,0 @@ ---- -# file: roles/cleanup/tasks/remove_package.yaml - -- name: Remove Package - Fix Corrupted APT - shell: "dpkg --configure -a" - when: - - ansible_distribution == 'Ubuntu' - tags: - - remove-package - -- name: Remove Package - {{ package }} - apt: - name: "{{ package }}" - force: yes - purge: yes - state: "absent" - failed_when: no - when: - - ansible_distribution == 'Ubuntu' - tags: - - remove-package diff --git a/resources/tools/testbed-setup/ansible/roles/cleanup/tasks/sut.yaml b/resources/tools/testbed-setup/ansible/roles/cleanup/tasks/sut.yaml deleted file mode 100644 index d80a35b1cb..0000000000 --- a/resources/tools/testbed-setup/ansible/roles/cleanup/tasks/sut.yaml +++ /dev/null @@ -1,83 +0,0 @@ ---- -# file: roles/cleanup/tasks/sut.yaml - -- 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: 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 - 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 - 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: Remove Packages - Remove VPP - import_tasks: remove_package.yaml - vars: - package: "*vpp*" - tags: - - remove-package diff --git a/resources/tools/testbed-setup/ansible/roles/cleanup/tasks/tg.yaml b/resources/tools/testbed-setup/ansible/roles/cleanup/tasks/tg.yaml deleted file mode 100644 index fa2d2d2819..0000000000 --- a/resources/tools/testbed-setup/ansible/roles/cleanup/tasks/tg.yaml +++ /dev/null @@ -1,13 +0,0 @@ ---- -# file: roles/cleanup/tasks/tg.yaml - -- name: Host Cleanup - block: - - name: Kill Processes - TRex - import_tasks: kill_process.yaml - vars: - process: "_t-rex" - when: - - docker_tg is undefined - tags: - - kill-process diff --git a/resources/tools/testbed-setup/ansible/roles/cleanup/tasks/vpp_device.yaml b/resources/tools/testbed-setup/ansible/roles/cleanup/tasks/vpp_device.yaml deleted file mode 100644 index 41c4b29d37..0000000000 --- a/resources/tools/testbed-setup/ansible/roles/cleanup/tasks/vpp_device.yaml +++ /dev/null @@ -1,32 +0,0 @@ ---- -# file: roles/cleanup/tasks/vpp_device.yaml - -- name: Host Cleanup - block: - - name: Reset vpp_device Binary - copy: - src: "files/reset_vppdevice.sh" - dest: "/usr/local/bin" - owner: "root" - group: "root" - mode: "744" - tags: - - reset-sriov - - - name: Clean Images - import_tasks: clean_images.yaml - vars: - images_to_prefetch_by_arch: - aarch64: - - "fdiotools/builder-ubuntu2004:prod-aarch64" - - "fdiotools/builder-ubuntu1804:prod-aarch64" - - "fdiotools/builder-centos8:prod-aarch64" - 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" - tags: - - clean-images
\ No newline at end of file |