summaryrefslogtreecommitdiffstats
path: root/roles/docker
diff options
context:
space:
mode:
Diffstat (limited to 'roles/docker')
-rw-r--r--roles/docker/defaults/main.yml2
-rw-r--r--roles/docker/tasks/main.yml41
-rw-r--r--roles/docker/vars/main.yml2
3 files changed, 22 insertions, 23 deletions
diff --git a/roles/docker/defaults/main.yml b/roles/docker/defaults/main.yml
new file mode 100644
index 000000000..1b26af0dd
--- /dev/null
+++ b/roles/docker/defaults/main.yml
@@ -0,0 +1,2 @@
+---
+docker_version: '' \ No newline at end of file
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:
diff --git a/roles/docker/vars/main.yml b/roles/docker/vars/main.yml
index 162487545..606cdb9b9 100644
--- a/roles/docker/vars/main.yml
+++ b/roles/docker/vars/main.yml
@@ -1,3 +1,3 @@
---
-
+repoquery_cmd: "{{ 'dnf repoquery --latest-limit 1 -d 0' if ansible_pkg_mgr == 'dnf' else 'repoquery' }}"
udevw_udevd_dir: /etc/systemd/system/systemd-udevd.service.d