41c93a403d
ansible_facts should be used instead of the injected vars Change-Id: I9e6e0a257d8abf844063b257b3d9026ec8c9ce6c
61 lines
1.5 KiB
YAML
61 lines
1.5 KiB
YAML
---
|
|
- name: restart docker
|
|
command: /bin/true
|
|
notify:
|
|
- Docker | reload systemd
|
|
- Docker | reload docker
|
|
- Docker | pause while Docker restarts
|
|
- Docker | wait for docker
|
|
listen: "restart docker service"
|
|
|
|
- name: restart docker-distribution
|
|
command: /bin/true
|
|
notify:
|
|
- Docker | reload systemd
|
|
- Docker | reload docker-distribution
|
|
listen: "restart docker-distribution service"
|
|
|
|
- name: Docker | reload systemd
|
|
systemd:
|
|
daemon_reload: yes
|
|
become: true
|
|
when: ansible_facts['service_mgr'] == 'systemd'
|
|
|
|
- name: Docker | reload docker
|
|
service:
|
|
name: docker
|
|
state: restarted
|
|
become: true
|
|
|
|
- name: Docker | pause while Docker restarts
|
|
pause:
|
|
seconds: 10
|
|
prompt: "Waiting for docker restart"
|
|
|
|
- name: Docker | wait for docker
|
|
command: /usr/bin/docker images
|
|
register: docker_ready
|
|
retries: 10
|
|
delay: 5
|
|
until: docker_ready.rc == 0
|
|
|
|
- name: Docker | reload docker-distribution
|
|
service:
|
|
name: docker-distribution
|
|
state: restarted
|
|
notify:
|
|
- Docker | wait for registry
|
|
become: true
|
|
|
|
# NOTE(bogdando): import caveats https://github.com/ansible/ansible/issues/42621
|
|
- name: Docker | wait for registry
|
|
uri:
|
|
# Just checking API version should be fine
|
|
# https://docs.docker.com/registry/spec/api/#api-version-check
|
|
url: "http://{{ container_registry_host }}:{{ container_registry_port }}/v2/"
|
|
return_content: yes
|
|
register: registry_status
|
|
retries: 10
|
|
delay: 5
|
|
until: "registry_status.status|int == 200 and 'OK' in registry_status.msg"
|