aboutsummaryrefslogtreecommitdiffstats
path: root/fdio.infra.ansible/roles/cleanup
diff options
context:
space:
mode:
authorpmikus <pmikus@cisco.com>2021-08-18 12:04:27 +0000
committerpmikus <pmikus@cisco.com>2021-08-18 12:04:27 +0000
commitd41a5490f30a161561c39c4f1b08add17b9cf6f7 (patch)
tree4244f8492f66f5ba1afe1c85c3a55340b125c8f7 /fdio.infra.ansible/roles/cleanup
parenta24c98b45ca1e9d56039d7649f65ac31e006d949 (diff)
Infra: Ansible yaml lint cleanup
Signed-off-by: pmikus <pmikus@cisco.com> Change-Id: If00b376bd78b7b603d7887c1e149e7dccdb6d217
Diffstat (limited to 'fdio.infra.ansible/roles/cleanup')
-rw-r--r--fdio.infra.ansible/roles/cleanup/tasks/clean_images.yaml20
-rw-r--r--fdio.infra.ansible/roles/cleanup/tasks/kill_containers.yaml56
-rw-r--r--fdio.infra.ansible/roles/cleanup/tasks/kill_process.yaml54
-rw-r--r--fdio.infra.ansible/roles/cleanup/tasks/nomad.yaml2
-rw-r--r--fdio.infra.ansible/roles/cleanup/tasks/remove_package.yaml6
-rw-r--r--fdio.infra.ansible/roles/cleanup/tasks/vpp_device.yaml52
6 files changed, 95 insertions, 95 deletions
diff --git a/fdio.infra.ansible/roles/cleanup/tasks/clean_images.yaml b/fdio.infra.ansible/roles/cleanup/tasks/clean_images.yaml
index e030acbff2..7558ee0fd7 100644
--- a/fdio.infra.ansible/roles/cleanup/tasks/clean_images.yaml
+++ b/fdio.infra.ansible/roles/cleanup/tasks/clean_images.yaml
@@ -24,13 +24,13 @@
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
+# 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
diff --git a/fdio.infra.ansible/roles/cleanup/tasks/kill_containers.yaml b/fdio.infra.ansible/roles/cleanup/tasks/kill_containers.yaml
index 25fd48e420..750572feb9 100644
--- a/fdio.infra.ansible/roles/cleanup/tasks/kill_containers.yaml
+++ b/fdio.infra.ansible/roles/cleanup/tasks/kill_containers.yaml
@@ -3,40 +3,40 @@
- 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 - Get Running Docker Containers
+ shell: "docker ps -aq"
+ register: running_containers
+ changed_when: false
+ 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
rescue:
- - name: Restart Docker Daemon
- systemd:
- name: "docker"
- state: "restarted"
+ - 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 - Get Running LXC Containers
+ 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 }}"
- 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 LXC containers failed!" \ No newline at end of file
+ - fail:
+ msg: "Kill LXC containers failed!"
diff --git a/fdio.infra.ansible/roles/cleanup/tasks/kill_process.yaml b/fdio.infra.ansible/roles/cleanup/tasks/kill_process.yaml
index c7cee37485..d6c6ed5118 100644
--- a/fdio.infra.ansible/roles/cleanup/tasks/kill_process.yaml
+++ b/fdio.infra.ansible/roles/cleanup/tasks/kill_process.yaml
@@ -3,35 +3,35 @@
- 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: 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
+ - 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
+ - wait_for:
+ path: "/proc/{{ item }}/status"
+ state: "absent"
+ with_items: "{{ running_processes.stdout_lines }}"
+ ignore_errors: true
+ 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!"
+ - fail:
+ msg: "Kill process {{ process }} failed!"
diff --git a/fdio.infra.ansible/roles/cleanup/tasks/nomad.yaml b/fdio.infra.ansible/roles/cleanup/tasks/nomad.yaml
index 3c5bf6462d..3d8f322840 100644
--- a/fdio.infra.ansible/roles/cleanup/tasks/nomad.yaml
+++ b/fdio.infra.ansible/roles/cleanup/tasks/nomad.yaml
@@ -19,4 +19,4 @@
- "fdiotools/builder-centos8:prod-x86_64"
- "fdiotools/builder-centos7:prod-x86_64"
tags:
- - clean-images \ No newline at end of file
+ - 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 302b43c99a..484868e595 100644
--- a/fdio.infra.ansible/roles/cleanup/tasks/remove_package.yaml
+++ b/fdio.infra.ansible/roles/cleanup/tasks/remove_package.yaml
@@ -11,10 +11,10 @@
- name: Remove Package - {{ package }}
apt:
name: "{{ package }}"
- force: yes
- purge: yes
+ force: true
+ purge: true
state: "absent"
- failed_when: no
+ failed_when: false
when:
- ansible_distribution == 'Ubuntu'
tags:
diff --git a/fdio.infra.ansible/roles/cleanup/tasks/vpp_device.yaml b/fdio.infra.ansible/roles/cleanup/tasks/vpp_device.yaml
index 41c4b29d37..23d001fe6f 100644
--- a/fdio.infra.ansible/roles/cleanup/tasks/vpp_device.yaml
+++ b/fdio.infra.ansible/roles/cleanup/tasks/vpp_device.yaml
@@ -3,30 +3,30 @@
- 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: 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
+ - 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