From f004b526078b78b0ba9435b82af4d4f4d42de5e2 Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Mon, 27 Jun 2016 15:44:04 -0300 Subject: More docker upgrade fixes. --- .../openshift-cluster/upgrades/docker/upgrade.yml | 9 ++++--- .../upgrades/docker/upgrade_check.yml | 28 ++++++++++------------ .../upgrades/v3_1_to_v3_2/upgrade.yml | 2 +- 3 files changed, 17 insertions(+), 22 deletions(-) (limited to 'playbooks/common/openshift-cluster') diff --git a/playbooks/common/openshift-cluster/upgrades/docker/upgrade.yml b/playbooks/common/openshift-cluster/upgrades/docker/upgrade.yml index 81db9ef20..20d66522f 100644 --- a/playbooks/common/openshift-cluster/upgrades/docker/upgrade.yml +++ b/playbooks/common/openshift-cluster/upgrades/docker/upgrade.yml @@ -11,16 +11,15 @@ - etcd_container - openvswitch failed_when: false - when: docker_upgrade | bool and openshift.common.is_containerized | bool + when: openshift.common.is_containerized | bool - name: Remove all containers and images script: nuke_images.sh docker register: nuke_images_result - when: docker_upgrade | bool and docker_upgrade_nuke_images is defined and docker_upgrade_nuke_images | bool + when: docker_upgrade_nuke_images is defined and docker_upgrade_nuke_images | bool - name: Upgrade Docker action: "{{ ansible_pkg_mgr }} name=docker{{ '-' + docker_version }} state=present" - when: docker_upgrade | bool - name: Restart containerized services service: name={{ item }} state=started @@ -32,7 +31,7 @@ - "{{ openshift.common.service_type }}-master-controllers" - "{{ openshift.common.service_type }}-node" failed_when: false - when: docker_upgrade | bool and openshift.common.is_containerized | bool + when: openshift.common.is_containerized | bool - name: Wait for master API to come back online become: no @@ -42,4 +41,4 @@ state=started delay=10 port="{{ openshift.master.api_port }}" - when: docker_upgrade | bool and inventory_hostname in groups.oo_masters_to_config + when: inventory_hostname in groups.oo_masters_to_config diff --git a/playbooks/common/openshift-cluster/upgrades/docker/upgrade_check.yml b/playbooks/common/openshift-cluster/upgrades/docker/upgrade_check.yml index 7fd4657d5..0a70ab723 100644 --- a/playbooks/common/openshift-cluster/upgrades/docker/upgrade_check.yml +++ b/playbooks/common/openshift-cluster/upgrades/docker/upgrade_check.yml @@ -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','>=') + diff --git a/playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/upgrade.yml b/playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/upgrade.yml index bea1eb4e1..6c27b0d44 100644 --- a/playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/upgrade.yml +++ b/playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/upgrade.yml @@ -86,7 +86,7 @@ when: docker_upgrade is not defined or docker_upgrade | bool - include: ../docker/upgrade.yml - when: docker_upgrade | bool + when: l_docker_upgrade is defined and l_docker_upgrade | bool - include: rpm_upgrade.yml vars: -- cgit v1.2.3