Add docker_image_remove module. (#732)

This commit is contained in:
Felix Fontein
2023-12-31 15:13:04 +01:00
committed by GitHub
parent 66b341aa9e
commit c3f8f80a75
27 changed files with 635 additions and 72 deletions
@@ -47,9 +47,8 @@
with_items: "{{ cnames }}"
diff: false
- name: "Make sure all images are removed"
docker_image:
docker_image_remove:
name: "{{ item }}"
state: absent
with_items: "{{ inames }}"
- name: "Make sure all networks are removed"
docker_network:
@@ -384,9 +384,8 @@
- name: Pull {{ docker_test_image_hello_world }} image to make sure wildcard_2 test succeeds
# If the image isn't there, it will pull it and return 'changed'.
docker_image:
docker_image_pull:
name: "{{ docker_test_image_hello_world }}"
source: pull
- name: wildcard
docker_container:
@@ -11,9 +11,8 @@
cnames: "{{ cnames + [cname] }}"
- name: Pull images
docker_image:
docker_image_pull:
name: "{{ image }}"
source: pull
loop:
- "{{ docker_test_image_hello_world }}"
- "{{ docker_test_image_alpine }}"
@@ -69,10 +68,9 @@
- name: Untag image
# Image will not be deleted since the container still uses it
docker_image:
docker_image_remove:
name: "{{ docker_test_image_alpine }}"
force_absent: true
state: absent
force: true
- name: Create container with {{ docker_test_image_alpine }} image via name (check mode, will pull, same image)
docker_container:
@@ -2235,9 +2235,8 @@
- name: Pull images to make sure ignore_image test succeeds
# If the image isn't there, it will pull it and return 'changed'.
docker_image:
docker_image_pull:
name: "{{ item }}"
source: pull
loop:
- "{{ docker_test_image_hello_world }}"
- "{{ docker_test_image_registry_nginx }}"
@@ -2456,9 +2455,8 @@
diff: false
- name: cleanup image
docker_image:
docker_image_remove:
name: "{{ iname_labels }}"
state: absent
diff: false
- assert:
@@ -2486,9 +2484,8 @@
- name: Pull images to make sure ignore_image test succeeds
# If the image isn't there, it will pull it and return 'changed'.
docker_image:
docker_image_pull:
name: "{{ item }}"
source: pull
loop:
- "{{ docker_test_image_hello_world }}"
- "{{ docker_test_image_registry_nginx }}"
@@ -2577,9 +2574,8 @@
inames: "{{ inames + [iname_name_mismatch] }}"
- name: Tag hello world image (pulled earlier) with new name
docker_image:
docker_image_tag:
name: "{{ docker_test_image_registry_nginx }}"
source: local
repository: "{{ iname_name_mismatch }}:latest"
- name: image_name_mismatch
@@ -2617,9 +2613,8 @@
diff: false
- name: Cleanup image
docker_image:
docker_image_remove:
name: "{{ iname_name_mismatch }}"
state: absent
diff: false
- assert:
@@ -3549,9 +3544,8 @@ avoid such warnings, please quote the value.' in (log_options_2.warnings | defau
####################################################################
- name: Remove hello-world image
docker_image:
docker_image_remove:
name: hello-world:latest
state: absent
- name: platform
docker_container: