summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrenton Leanhardt <bleanhar@redhat.com>2016-04-15 09:47:02 -0400
committerBrenton Leanhardt <bleanhar@redhat.com>2016-04-15 09:47:02 -0400
commita9893ab91495a7b5530648191291bcb9de9cd291 (patch)
tree34d7a86c22ae1ec3b30aa400c344d64ad1a86f05
parentb9099c18e7405f208b81d5969112dd71da100c5b (diff)
parent8a73c1c736af5922aeb5f5fc37783ab5f6f97f4d (diff)
downloadopenshift-a9893ab91495a7b5530648191291bcb9de9cd291.tar.gz
openshift-a9893ab91495a7b5530648191291bcb9de9cd291.tar.bz2
openshift-a9893ab91495a7b5530648191291bcb9de9cd291.tar.xz
openshift-a9893ab91495a7b5530648191291bcb9de9cd291.zip
Merge pull request #1755 from sdodson/docker-reset
Refactor docker failed state cleanup
-rw-r--r--roles/docker/tasks/main.yml22
1 files changed, 8 insertions, 14 deletions
diff --git a/roles/docker/tasks/main.yml b/roles/docker/tasks/main.yml
index f06e4875b..878d5fea8 100644
--- a/roles/docker/tasks/main.yml
+++ b/roles/docker/tasks/main.yml
@@ -24,29 +24,23 @@
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')
-- name: Start the docker service
- service:
- name: docker
- enabled: yes
- state: started
- register: start_result
- ignore_errors: yes
+# If docker were enabled and started before we downgraded it may have entered a
+# failed state. Check for that and clear it if necessary.
+- name: Check that docker hasn't entered failed state
+ command: systemctl show docker
+ register: docker_state
+ changed_when: False
-# 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: start_result | failed
- register: reset_failed
+ when: " 'ActiveState=failed' in docker_state.stdout "
-- name: Start the docker service if it had failed
+- name: Start the docker service
service:
name: docker
enabled: yes
state: started
register: start_result
- when: reset_failed | changed
- set_fact:
docker_service_status_changed: start_result | changed