2018-10-26 02:51:41 +02:00
|
|
|
---
|
|
|
|
####################################################################
|
|
|
|
## basic ###########################################################
|
|
|
|
####################################################################
|
|
|
|
|
|
|
|
- name: Make sure image is not there
|
|
|
|
docker_image:
|
|
|
|
name: "hello-world:latest"
|
|
|
|
state: absent
|
2019-03-14 10:46:38 +01:00
|
|
|
force_absent: yes
|
2018-10-26 02:51:41 +02:00
|
|
|
register: absent_1
|
|
|
|
|
|
|
|
- name: Make sure image is not there (idempotency)
|
|
|
|
docker_image:
|
|
|
|
name: "hello-world:latest"
|
|
|
|
state: absent
|
|
|
|
register: absent_2
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- absent_2 is not changed
|
|
|
|
|
|
|
|
- name: Make sure image is there
|
|
|
|
docker_image:
|
|
|
|
name: "hello-world:latest"
|
|
|
|
state: present
|
2019-03-14 10:46:38 +01:00
|
|
|
source: pull
|
2018-10-26 02:51:41 +02:00
|
|
|
register: present_1
|
|
|
|
|
|
|
|
- name: Make sure image is there (idempotent)
|
|
|
|
docker_image:
|
|
|
|
name: "hello-world:latest"
|
|
|
|
state: present
|
2019-03-14 10:46:38 +01:00
|
|
|
source: pull
|
2018-10-26 02:51:41 +02:00
|
|
|
register: present_2
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- present_1 is changed
|
|
|
|
- present_2 is not changed
|
|
|
|
|
2019-03-08 09:28:42 +01:00
|
|
|
- name: Make sure tag is not there
|
|
|
|
docker_image:
|
|
|
|
name: "hello-world:alias"
|
|
|
|
state: absent
|
|
|
|
|
|
|
|
- name: Tag image with alias
|
|
|
|
docker_image:
|
2019-04-17 19:50:57 +02:00
|
|
|
source: local
|
2019-03-08 09:28:42 +01:00
|
|
|
name: "hello-world:latest"
|
|
|
|
repository: "hello-world:alias"
|
|
|
|
register: tag_1
|
|
|
|
|
|
|
|
- name: Tag image with alias (idempotent)
|
|
|
|
docker_image:
|
2019-04-17 19:50:57 +02:00
|
|
|
source: local
|
2019-03-08 09:28:42 +01:00
|
|
|
name: "hello-world:latest"
|
|
|
|
repository: "hello-world:alias"
|
|
|
|
register: tag_2
|
|
|
|
|
|
|
|
- name: Tag image with alias (force, still idempotent)
|
|
|
|
docker_image:
|
2019-04-17 19:50:57 +02:00
|
|
|
source: local
|
2019-03-08 09:28:42 +01:00
|
|
|
name: "hello-world:latest"
|
|
|
|
repository: "hello-world:alias"
|
2019-04-17 19:50:57 +02:00
|
|
|
force_tag: yes
|
2019-03-08 09:28:42 +01:00
|
|
|
register: tag_3
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- tag_1 is changed
|
|
|
|
- tag_2 is not changed
|
|
|
|
- tag_3 is not changed
|
|
|
|
|
|
|
|
- name: Cleanup alias tag
|
|
|
|
docker_image:
|
|
|
|
name: "hello-world:alias"
|
|
|
|
state: absent
|