-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcleanup.yml
41 lines (35 loc) · 1002 Bytes
/
cleanup.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
---
- name: Cleanup containers
hosts: registry
vars_files:
- vars/quay-registry-vars.yml
- vars/mirror-vars.yml
tasks:
- name: Cleanup containers and images
when: clean_images
block:
- name: Get the images to remove
become: yes
command: podman images -n
register: images
- name: Remove the images
become: yes
command: podman rmi -f {{ item.split()[2] }}
loop: "{{ images.stdout_lines }}"
loop_control:
label: "{{ item.split()[0] }}"
- name: Reload the images to the local registry
become: yes
command: podman load -i {{ item }}
loop: "{{ tar_images }}"
- name: Cleanup old quay data
become: yes
when: clean_data
file:
path: "{{ base_dir }}"
state: absent
- name: Cleanup old bundle dir
when: clean_bundle
file:
path: "{{ removable_media_path }}"
state: absent