|
@@ -1,13 +1,11 @@
|
|
|
---
|
|
|
|
|
|
-# This snippet determines if docker_upgrade should be set for the host. If it's already
|
|
|
-# set via the inventory we will respect it. Otherwise we check if the current version
|
|
|
-# is equal to the either the latest, or the requested docker_version, and set
|
|
|
-# docker_upgrade accordingly.
|
|
|
+# This snippet determines if a Docker upgrade is required by checking the inventory
|
|
|
+# variables, the available packages, and sets l_docker_version to True if so.
|
|
|
|
|
|
-- name: Determine available Docker version
|
|
|
- script: ../../../../common/openshift-cluster/upgrades/files/rpm_versions.sh docker
|
|
|
- register: g_docker_version_result
|
|
|
+- set_fact:
|
|
|
+ docker_upgrade: True
|
|
|
+ when: docker_upgrade is not defined
|
|
|
|
|
|
- name: Check if Docker is installed
|
|
|
command: rpm -q docker
|
|
@@ -32,24 +30,22 @@
|
|
|
# Disable the 1.10 requirement if the user set a specific Docker version
|
|
|
when: avail_docker_version.stdout | version_compare('1.10','<') and docker_version is not defined
|
|
|
|
|
|
-# We respect docker_upgrade=False in the inventory, but True is the default and
|
|
|
-# if set in inventory, we still flip it to False here and only set to true if
|
|
|
-# they're not already running the required version.
|
|
|
+# Default l_docker_upgrade to False, we'll set to True if an upgrade is required:
|
|
|
- set_fact:
|
|
|
- docker_upgrade: False
|
|
|
- when: docker_upgrade is not defined or docker_upgrade | bool
|
|
|
+ l_docker_upgrade: False
|
|
|
|
|
|
# Make sure a docker_verison is set if none was requested:
|
|
|
- set_fact:
|
|
|
- docker_version: avail_docker_version.stdout
|
|
|
+ docker_version: "{{ avail_docker_version.stdout }}"
|
|
|
when: docker_version is not defined
|
|
|
|
|
|
- name: Flag for Docker upgrade if necessary
|
|
|
set_fact:
|
|
|
- docker_upgrade: True
|
|
|
- when: docker_version is defined and pkg_check.rc == 0 and curr_docker_version.stdout | version_compare(docker_version,'<')
|
|
|
+ l_docker_upgrade: True
|
|
|
+ when: pkg_check.rc == 0 and curr_docker_version.stdout | version_compare(docker_version,'<')
|
|
|
|
|
|
- name: Flag to delete all images prior to upgrade if crossing Docker 1.10 boundary
|
|
|
set_fact:
|
|
|
docker_upgrade_nuke_images: True
|
|
|
- when: docker_upgrade_nuke_images is not defined and docker_upgrade | bool and curr_docker_version.stdout | version_compare('1.10','<') and docker_version | version_compare('1.10','>=')
|
|
|
+ when: docker_upgrade_nuke_images is not defined and curr_docker_version.stdout | version_compare('1.10','<') and docker_version | version_compare('1.10','>=')
|
|
|
+
|