Skip to content

Commit

Permalink
Wait for Docker to start before re-reading Ansible facts. (#9)
Browse files Browse the repository at this point in the history
Wait for Docker to start before re-reading Ansible facts. "service state=started"
doesn't wait until the service is actually running, so it was possible that we'd
try to reread docker facts before Docker had started, and they'd stay blank.
  • Loading branch information
ostacey authored Nov 9, 2016
1 parent 4565277 commit ffe7ce6
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
3 changes: 3 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
Version 2.2.1:
- wait for Docker to actually be running before re-reading ansible docker facts.

Version 2.2:
- Removed the upgrade fixes added in Version 2.1.
- No longer pass the "--force-confnew" flag to apt when installing the Docker package.
Expand Down
6 changes: 6 additions & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,9 @@ docker_role_apt_cache_valid_time: 7200

# These flags are passed to the Docker daemon on startup.
docker_daemon_flags: ""


# When we start / restart Docker, this role waits until it is ready before
# proceeding. This variable controls how long we wait before giving up.
# This value should be OK for all but the slowest servers.
docker_daemon_startup_timeout_sec: 10
7 changes: 7 additions & 0 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,13 @@
- name: Ensure that Docker is running
service: name="docker" state=started

- name: Wait until docker daemon is available
command: docker info
register: r_docker_info
until: r_docker_info.rc == 0
retries: "{{ docker_daemon_startup_timeout_sec }}"
delay: 1

- name: reread docker facts
setup: filter=ansible_docker0
when: r_etc_default_docker|changed or r_docker_package_install|changed
Expand Down

0 comments on commit ffe7ce6

Please sign in to comment.