--- # 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. - name: Determine available Docker version script: ../../../../common/openshift-cluster/upgrades/files/rpm_versions.sh docker register: g_docker_version_result - name: Check if Docker is installed command: rpm -q docker register: pkg_check failed_when: pkg_check.rc > 1 changed_when: no - name: Get current version of Docker command: "{{ repoquery_cmd }} --installed --qf '%{version}' docker" register: curr_docker_version changed_when: false - name: Get latest available version of Docker command: > {{ repoquery_cmd }} --qf '%{version}' "docker" register: avail_docker_version failed_when: false changed_when: false - fail: msg: This playbook requires access to Docker 1.10 or later # 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. - set_fact: docker_upgrade: False when: docker_upgrade is not defined or docker_upgrade | bool - name: Flag for upgrade if Docker version does not equal latest set_fact: docker_upgrade: true when: docker_version is not defined and pkg_check.rc == 0 and curr_docker_version.stdout | version_compare(avail_docker_version.stdout,'<') - name: Flag for upgrade if Docker version does not equal requested version set_fact: docker_upgrade: true when: docker_version is defined and pkg_check.rc == 0 and curr_docker_version.stdout | version_compare(docker_version,'<')