summaryrefslogtreecommitdiffstats
path: root/roles/docker/tasks
diff options
context:
space:
mode:
authorBrenton Leanhardt <bleanhar@redhat.com>2016-06-07 13:51:44 -0400
committerBrenton Leanhardt <bleanhar@redhat.com>2016-06-07 13:51:44 -0400
commit12f351d71b13feb4b808b15f6756fbf6a81de587 (patch)
tree8cd3ea02fb98cae19a6288b02abc508b728c8fc0 /roles/docker/tasks
parent377405b67551ef51ce6f644bde018986465a1e0c (diff)
parentc45c5935df97bb4aa9e8e9067d868371b04a24bf (diff)
downloadopenshift-12f351d71b13feb4b808b15f6756fbf6a81de587.tar.gz
openshift-12f351d71b13feb4b808b15f6756fbf6a81de587.tar.bz2
openshift-12f351d71b13feb4b808b15f6756fbf6a81de587.tar.xz
openshift-12f351d71b13feb4b808b15f6756fbf6a81de587.zip
Merge branch 'docker1.10' of https://github.com/dgoodwin/openshift-ansible
Diffstat (limited to 'roles/docker/tasks')
-rw-r--r--roles/docker/tasks/main.yml59
1 files changed, 30 insertions, 29 deletions
diff --git a/roles/docker/tasks/main.yml b/roles/docker/tasks/main.yml
index b9b2666fb..f002dbc01 100644
--- a/roles/docker/tasks/main.yml
+++ b/roles/docker/tasks/main.yml
@@ -1,41 +1,42 @@
---
-# tasks file for docker
-
-- name: Get current installed version if docker_version is specified
+# Going forward we require Docker 1.10 or greater. If the user has a lesser version installed they must run a separate upgrade process.
+- name: Get current installed Docker version
command: "{{ repoquery_cmd }} --installed --qf '%{version}' docker"
- when: not openshift.common.is_atomic | bool and docker_version != ''
- register: docker_version_result
+ when: not openshift.common.is_atomic | bool
+ register: curr_docker_version
changed_when: false
-- stat: path=/etc/sysconfig/docker-storage
- register: docker_storage_check
+# TODO: The use of upgrading var will be removed in the coming upgrade refactor. This is a temporary
+# fix to wory around the fact that right now, this role is called during upgrade, before we're
+# ready to upgrade Docker.
+- name: Fail if Docker upgrade is required
+ fail:
+ msg: "Docker {{ curr_docker_version.stdout }} must be upgraded to Docker 1.10 or greater"
+ when: not upgrading | bool and not curr_docker_version | skipped and curr_docker_version.stdout | default('0.0', True) | version_compare('1.10', '<')
-- name: Remove deferred deletion for downgrades from 1.9
+- name: Get latest available version of Docker
command: >
- sed -i 's/--storage-opt dm.use_deferred_deletion=true//' /etc/sysconfig/docker-storage
- when: docker_storage_check.stat.exists | bool and not docker_version_result | skipped and docker_version_result.stdout | default('0.0', True) | version_compare('1.9', '>=') and docker_version | version_compare('1.9', '<')
-
-- name: Downgrade docker if necessary
- command: "{{ ansible_pkg_mgr }} swap -y docker-* docker-*{{ docker_version }}"
- register: docker_downgrade_result
- when: not docker_version_result | skipped and docker_version_result.stdout | default('0.0', True) | version_compare(docker_version, 'gt')
+ {{ repoquery_cmd }} --qf '%{version}' "docker"
+ register: avail_docker_version
+ failed_when: false
+ changed_when: false
+ when: not openshift.common.is_atomic | bool
-- name: Install docker
- 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 docker_downgrade_result | skipped
+- name: Verify Docker >= 1.10 is available
+ fail:
+ msg: "Docker {{ avail_docker_version.stdout }} is available, but 1.10 or greater is required"
+ when: not avail_docker_version | skipped and avail_docker_version.stdout | default('0.0', True) | version_compare('1.10', '<')
-# 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
+- stat: path=/etc/sysconfig/docker-storage
+ register: docker_storage_check
-- name: Reset docker service state
- command: systemctl reset-failed docker.service
- when: " 'ActiveState=failed' in docker_state.stdout "
+# Make sure Docker is installed, but does not update a running version.
+# Docker upgrades are handled by a separate playbook.
+- name: Install Docker
+ action: "{{ ansible_pkg_mgr }} name=docker state=present"
+ when: not openshift.common.is_atomic | bool
-- name: Start the docker service
+- name: Start the Docker service
service:
name: docker
enabled: yes
@@ -86,7 +87,7 @@
notify:
- restart docker
-- name: Set various docker options
+- name: Set various Docker options
lineinfile:
dest: /etc/sysconfig/docker
regexp: '^OPTIONS=.*$'