kayobe/ansible/roles/docker-registry/tasks/destroy.yml
Raimund Hook 6df6277096 Updating Jinja filters to conform to Ansible 2.5+
Since Ansible 2.5, the use of jinja tests as filters has been deprecated.

I've run the script provided by the ansible team to 'fix' the jinja filters
to conform to the newer syntax.

This fixes the deprecation warnings.

Change-Id: I775c849c944f82bdfc779c8c530346e7ebedbd2a
2019-06-28 16:34:24 +01:00

30 lines
828 B
YAML

---
- name: Ensure docker registry container is stopped
docker_container:
name: "{{ item.value.container_name }}"
state: "absent"
with_dict: "{{ docker_registry_services }}"
- name: Check whether docker registry volumes are present
command: docker volume inspect {{ volume }}
changed_when: False
with_subelements:
- "{{ docker_registry_services }}"
- volumes
when: "'/' not in volume"
failed_when:
- volume_result.rc != 0
- "'No such volume' not in volume_result.stderr"
vars:
volume: "{{ item.1.split(':')[0] }}"
register: volume_result
- name: Ensure docker registry volumes are absent
command: docker volume rm {{ volume }}
with_items: "{{ volume_result.results }}"
when:
- item is not skipped
- item.rc == 0
vars:
volume: "{{ item.item.1.split(':')[0] }}"