2020-10-21 08:18:05 +02:00
|
|
|
---
|
2020-03-09 10:11:07 +01:00
|
|
|
- name: "Make sure all images are removed"
|
|
|
|
docker_image:
|
|
|
|
name: "{{ item }}"
|
|
|
|
state: absent
|
2020-10-21 08:18:05 +02:00
|
|
|
with_items: "{{ docker_registry_setup_inames }}"
|
2020-03-09 10:11:07 +01:00
|
|
|
- name: "Get registry logs"
|
2020-10-21 08:18:05 +02:00
|
|
|
command: "docker logs {{ docker_registry_container_name_registry }}"
|
2020-03-09 10:11:07 +01:00
|
|
|
register: registry_logs
|
|
|
|
no_log: yes
|
2020-05-20 08:40:04 +02:00
|
|
|
ignore_errors: yes
|
2020-03-09 10:11:07 +01:00
|
|
|
- name: "Printing registry logs"
|
2020-05-20 08:40:04 +02:00
|
|
|
debug:
|
|
|
|
var: registry_logs.stdout_lines
|
|
|
|
when: registry_logs is not failed
|
2020-10-21 08:18:05 +02:00
|
|
|
- name: "Get nginx logs for first instance"
|
|
|
|
command: "docker logs {{ docker_registry_container_name_nginx }}"
|
2020-03-09 10:11:07 +01:00
|
|
|
register: nginx_logs
|
|
|
|
no_log: yes
|
2020-05-20 08:40:04 +02:00
|
|
|
ignore_errors: yes
|
2020-10-21 08:18:05 +02:00
|
|
|
- name: "Get nginx logs for second instance"
|
|
|
|
command: "docker logs {{ docker_registry_container_name_nginx2 }}"
|
|
|
|
register: nginx2_logs
|
|
|
|
no_log: yes
|
|
|
|
ignore_errors: yes
|
|
|
|
- name: "Printing nginx logs for first instance"
|
2020-05-20 08:40:04 +02:00
|
|
|
debug:
|
|
|
|
var: nginx_logs.stdout_lines
|
|
|
|
when: nginx_logs is not failed
|
2020-10-21 08:18:05 +02:00
|
|
|
- name: "Printing nginx logs for second instance"
|
|
|
|
debug:
|
|
|
|
var: nginx2_logs.stdout_lines
|
|
|
|
when: nginx_logs is not failed
|
2020-03-09 10:11:07 +01:00
|
|
|
- name: "Make sure all containers are removed"
|
|
|
|
docker_container:
|
|
|
|
name: "{{ item }}"
|
|
|
|
state: absent
|
|
|
|
force_kill: yes
|
2020-10-21 08:18:05 +02:00
|
|
|
with_items: "{{ docker_registry_setup_cnames }}"
|
2020-03-09 10:11:07 +01:00
|
|
|
register: result
|
|
|
|
retries: 3
|
|
|
|
delay: 3
|
|
|
|
until: result is success
|
|
|
|
- name: "Make sure all volumes are removed"
|
|
|
|
command: "docker rm -f {{ item }}"
|
2020-10-21 08:18:05 +02:00
|
|
|
with_items: "{{ docker_registry_setup_vnames }}"
|
2020-03-09 10:11:07 +01:00
|
|
|
ignore_errors: yes
|