summaryrefslogtreecommitdiffstats
path: root/roles/docker/tasks/main.yml
diff options
context:
space:
mode:
authorBrenton Leanhardt <bleanhar@redhat.com>2016-04-05 14:46:23 -0400
committerBrenton Leanhardt <bleanhar@redhat.com>2016-04-05 14:46:23 -0400
commit20365026351eff3a68ce78374ad7afbd447952ab (patch)
treeb67dddfa41b36636f6a628894b97ccbb719aabd2 /roles/docker/tasks/main.yml
parent9db67b8095b206efefeb2c3def07e1e4394733d0 (diff)
parent18b52f2c4ef11b34b248b48ce5ca59d7c5a4f426 (diff)
downloadopenshift-20365026351eff3a68ce78374ad7afbd447952ab.tar.gz
openshift-20365026351eff3a68ce78374ad7afbd447952ab.tar.bz2
openshift-20365026351eff3a68ce78374ad7afbd447952ab.tar.xz
openshift-20365026351eff3a68ce78374ad7afbd447952ab.zip
Merge pull request #1655 from sdodson/more-docker19
Downgrade to docker 1.8.2 if installing < 1.2/3.2
Diffstat (limited to 'roles/docker/tasks/main.yml')
-rw-r--r--roles/docker/tasks/main.yml41
1 files changed, 19 insertions, 22 deletions
diff --git a/roles/docker/tasks/main.yml b/roles/docker/tasks/main.yml
index 9709c5014..9cf949d65 100644
--- a/roles/docker/tasks/main.yml
+++ b/roles/docker/tasks/main.yml
@@ -1,32 +1,29 @@
---
# tasks file for docker
-# Avoid docker 1.9 when installing origin < 1.2 or OSE < 3.2 on RHEL/Centos and
-# See: https://bugzilla.redhat.com/show_bug.cgi?id=1304038
+- name: Get current installed version if docker_version is specified
+ command: "{{ repoquery_cmd }} --installed --qf '%{version}' docker"
+ when: not openshift.common.is_atomic | bool and docker_version != ''
+ register: docker_version_result
+ changed_when: false
-- name: Default to latest docker for 1.2/3.2 or Fedora
- set_fact:
- docker_version: ''
- when: openshift.common.version_gte_3_2_or_1_2 | bool or ansible_distribution == 'Fedora'
+- name: Downgrade docker if necessary
+ command: "{{ ansible_pkg_mgr }} downgrade -y docker-{{ docker_version }}"
+ register: docker_downgrade_result
+ when: not docker_version_result | skipped and docker_version_result | default('0.0', True) | version_compare(docker_version, 'gt')
-- name: Gather latest version of docker
- shell: >
- yum list available -e 0 -q "docker" 2>&1 | tail -n +2 | awk '{ print $2 }' | sort -r | tr '\n' ' ' | tail -n 1
- register: latest_docker
- when: not openshift.common.version_gte_3_2_or_1_2 | bool and ansible_distribution != 'Fedora'
-
-- name: Check if Docker 1.9 is the latest
- set_fact:
- docker19_is_latest: "{{ True if '1.9' in latest_docker.stdout else False }}"
- when: not openshift.common.version_gte_3_2_or_1_2 | bool and ansible_distribution != 'Fedora'
+- name: Install docker
+ action: "{{ ansible_pkg_mgr }} name=docker{{ '-' + docker_version if docker_version != '' else '' }} state=present"
+ when: not openshift.common.is_atomic | bool and not docker_downgrade_result | changed
-- set_fact:
- docker_version: "{{ '-1.8.2' if docker19_is_latest | bool else ''}}"
- when: not openshift.common.version_gte_3_2_or_1_2 | bool and ansible_distribution != 'Fedora'
+- stat: path=/etc/sysconfig/docker
+ register: docker_check
+ when: docker_downgrade_result | changed
-- name: Install docker
- action: "{{ ansible_pkg_mgr }} name=docker{{ docker_version }} state=present"
- when: not openshift.common.is_atomic | bool
+- name: Remove deferred deletion for downgrades from 1.9
+ command: >
+ sed -i 's/--storage-opt dm.use_deferred_deletion=true//' /etc/sysconfig/docker-storage
+ when: docker_downgrade_result | changed and docker_check.stat.exists | bool and docker_version_result | default('0.0', True) | version_compare('1.9', '>=') and docker_version | version_compare('1.9', '<')
- name: enable and start the docker service
service: