Use a separate task to destroy node exporter, opensm and docker registry containers

This commit is contained in:
Mark Goddard 2017-11-29 11:41:21 +00:00
parent 12fc3f86e1
commit 91f01ff8af
6 changed files with 18 additions and 6 deletions

View File

@ -8,6 +8,6 @@
read_only: "{{ item.value.read_only | default(omit) }}" read_only: "{{ item.value.read_only | default(omit) }}"
restart_policy: "{{ docker_registry_restart_policy }}" restart_policy: "{{ docker_registry_restart_policy }}"
restart_retries: "{{ docker_registry_restart_retries | default(omit) }}" restart_retries: "{{ docker_registry_restart_retries | default(omit) }}"
state: "{{ (item.value.enabled and action != 'destroy') | ternary('started', 'absent') }}" state: "{{ item.value.enabled | ternary('started', 'absent') }}"
volumes: "{{ item.value.volumes }}" volumes: "{{ item.value.volumes }}"
with_dict: "{{ docker_registry_services }}" with_dict: "{{ docker_registry_services }}"

View File

@ -1,5 +1,9 @@
--- ---
- include: deploy.yml - 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 - name: Check whether docker registry volumes are present
command: docker volume inspect {{ volume }} command: docker volume inspect {{ volume }}

View File

@ -9,6 +9,6 @@
read_only: "{{ item.value.read_only | default(omit) }}" read_only: "{{ item.value.read_only | default(omit) }}"
restart_policy: "{{ nodeexporter_restart_policy }}" restart_policy: "{{ nodeexporter_restart_policy }}"
restart_retries: "{{ nodeexporter_restart_retries | default(omit) }}" restart_retries: "{{ nodeexporter_restart_retries | default(omit) }}"
state: "{{ (item.value.enabled and action != 'destroy') | ternary('started', 'absent') }}" state: "{{ item.value.enabled | ternary('started', 'absent') }}"
volumes: "{{ item.value.volumes }}" volumes: "{{ item.value.volumes }}"
with_dict: "{{ nodeexporter_services }}" with_dict: "{{ nodeexporter_services }}"

View File

@ -1,5 +1,9 @@
--- ---
- include: deploy.yml - name: Ensure node exporter container is stopped
docker_container:
name: "{{ item.value.container_name }}"
state: "absent"
with_dict: "{{ nodeexporter_services }}"
- name: Check whether Node Exporter volumes are present - name: Check whether Node Exporter volumes are present
command: docker volume inspect {{ volume }} command: docker volume inspect {{ volume }}

View File

@ -8,6 +8,6 @@
read_only: "{{ item.value.read_only | default(omit) }}" read_only: "{{ item.value.read_only | default(omit) }}"
restart_policy: "{{ opensm_restart_policy }}" restart_policy: "{{ opensm_restart_policy }}"
restart_retries: "{{ opensm_restart_retries | default(omit) }}" restart_retries: "{{ opensm_restart_retries | default(omit) }}"
state: "{{ (item.value.enabled and action != 'destroy') | ternary('started', 'absent') }}" state: "{{ item.value.enabled | ternary('started', 'absent') }}"
volumes: "{{ item.value.volumes }}" volumes: "{{ item.value.volumes }}"
with_dict: "{{ opensm_services }}" with_dict: "{{ opensm_services }}"

View File

@ -1,5 +1,9 @@
--- ---
- include: deploy.yml - name: Ensure OpenSM container is stopped
docker_container:
name: "{{ item.value.container_name }}"
state: "absent"
with_dict: "{{ opensm_services }}"
- name: Check whether OpenSM volumes are present - name: Check whether OpenSM volumes are present
command: docker volume inspect {{ volume }} command: docker volume inspect {{ volume }}