summaryrefslogtreecommitdiffstats
path: root/roles/docker
diff options
context:
space:
mode:
authorScott Dodson <sdodson@redhat.com>2016-04-14 13:13:18 -0400
committerScott Dodson <sdodson@redhat.com>2016-04-14 13:14:53 -0400
commit68535500e00aa9b5f349f6055f63082556c0ea30 (patch)
tree4d91e812971b42397f118d9a4effbb255e4a6fac /roles/docker
parent037a48562d5bcd152556d2068b14663b99ef46ef (diff)
downloadopenshift-68535500e00aa9b5f349f6055f63082556c0ea30.tar.gz
openshift-68535500e00aa9b5f349f6055f63082556c0ea30.tar.bz2
openshift-68535500e00aa9b5f349f6055f63082556c0ea30.tar.xz
openshift-68535500e00aa9b5f349f6055f63082556c0ea30.zip
start it, check for failure, reset it, start again
Diffstat (limited to 'roles/docker')
-rw-r--r--roles/docker/tasks/main.yml19
1 files changed, 11 insertions, 8 deletions
diff --git a/roles/docker/tasks/main.yml b/roles/docker/tasks/main.yml
index b15c1004e..f06e4875b 100644
--- a/roles/docker/tasks/main.yml
+++ b/roles/docker/tasks/main.yml
@@ -24,26 +24,29 @@
action: "{{ ansible_pkg_mgr }} name=docker{{ '-' + docker_version if docker_version is defined and docker_version != '' else '' }} state=present"
when: not openshift.common.is_atomic | bool and not docker_version_result | skipped and docker_version_result.stdout | default('0.0', True) | version_compare(docker_version, 'lt')
-# Enable docker and record if it was changed, if it was changed then we have no
-# need to reset-failed.
-- name: Enable the docker service
+- name: Start the docker service
service:
name: docker
enabled: yes
- register: docker_enabled
+ state: started
+ register: start_result
+ ignore_errors: yes
-# We're getting ready to start docker. This is a workaround for cases where it
-# seems a package install/upgrade/downgrade has rebooted docker and crashed it.
+# If docker were enabled and started before we downgraded it there's a real possibility
+# that it's marked failed, so if our first attempt to start it fails reset the failure
+# and start it again.
- name: Reset docker service state
command: systemctl reset-failed docker.service
- when: not docker_enabled | changed
+ when: start_result | failed
+ register: reset_failed
-- name: Start the docker service
+- name: Start the docker service if it had failed
service:
name: docker
enabled: yes
state: started
register: start_result
+ when: reset_failed | changed
- set_fact:
docker_service_status_changed: start_result | changed