summaryrefslogtreecommitdiffstats
path: root/roles/openshift_docker
diff options
context:
space:
mode:
authorDevan Goodwin <dgoodwin@redhat.com>2016-04-29 10:27:02 -0300
committerDevan Goodwin <dgoodwin@redhat.com>2016-05-12 16:07:04 -0300
commitcdf248533495b456008c8976fe4e216952590c6e (patch)
tree31ccf3b70594fcf879b520aa724020325173e1ce /roles/openshift_docker
parent1165565b15f27d913a10ba64441608d76907c3ba (diff)
downloadopenshift-cdf248533495b456008c8976fe4e216952590c6e.tar.gz
openshift-cdf248533495b456008c8976fe4e216952590c6e.tar.bz2
openshift-cdf248533495b456008c8976fe4e216952590c6e.tar.xz
openshift-cdf248533495b456008c8976fe4e216952590c6e.zip
Do not upgrade containers to latest avail during a normal config run.
Diffstat (limited to 'roles/openshift_docker')
-rw-r--r--roles/openshift_docker/tasks/main.yml25
1 files changed, 21 insertions, 4 deletions
diff --git a/roles/openshift_docker/tasks/main.yml b/roles/openshift_docker/tasks/main.yml
index 4e5cec82f..5d5174ec9 100644
--- a/roles/openshift_docker/tasks/main.yml
+++ b/roles/openshift_docker/tasks/main.yml
@@ -2,20 +2,37 @@
# It's important that we don't explicitly pull this image here. Otherwise we
# could result in upgrading a preinstalled environment. We'll have to set
# openshift_image_tag correctly for upgrades.
+
+- set_fact:
+ upgrading: False
+ when: upgrading is not defined
+
+- set_fact:
+ is_containerized: "{{ openshift.common.is_containerized | default(False) | bool }}"
+ # Does the host already have an image tag fact, used to determine if it's a new node
+ # in non-upgrade scenarios:
+ has_image_tag_fact: "{{ hostvars[inventory_hostname].openshift.docker.openshift_image_tag is defined }}"
+
- name: Set version when containerized
command: >
docker run --rm {{ openshift.common.cli_image }} version
register: cli_image_version
- when: openshift.common.is_containerized is defined and openshift.common.is_containerized | bool and openshift_image_tag is not defined
+ when: is_containerized | bool and openshift_image_tag is not defined and (upgrading | bool or not has_image_tag_fact | bool)
+
+# Use the pre-existing image tag from system facts if present, and we're not upgrading.
+# Ignores explicit openshift_image_tag if it's in the inventory, as this isn't an upgrade.
+- set_fact:
+ l_image_tag: "{{ hostvars[inventory_hostname].openshift.docker.openshift_image_tag }}"
+ when: is_containerized | bool and not upgrading | bool and has_image_tag_fact | bool
- set_fact:
l_image_tag: "{{ cli_image_version.stdout_lines[0].split(' ')[1].split('-')[0:2] | join('-') if openshift.common.deployment_type == 'origin' else
cli_image_version.stdout_lines[0].split(' ')[1].split('-')[0] }}"
- when: openshift.common.is_containerized is defined and openshift.common.is_containerized | bool and openshift_image_tag is not defined
+ when: is_containerized | bool and openshift_image_tag is not defined and (upgrading | bool or not has_image_tag_fact | bool)
- set_fact:
l_image_tag: "{{ openshift_image_tag }}"
- when: openshift.common.is_containerized is defined and openshift.common.is_containerized | bool and openshift_image_tag is defined
+ when: is_containerized | bool and openshift_image_tag is defined and (upgrading | bool or not has_image_tag_fact | bool)
- name: Set post docker install facts
openshift_facts:
@@ -26,4 +43,4 @@
local_facts:
openshift_image_tag: "{{ l_image_tag | default(None) }}"
openshift_version: "{{ l_image_tag.split('-')[0] | oo_image_tag_to_rpm_version if l_image_tag is defined else '' }}"
- when: openshift.common.is_containerized is defined and openshift.common.is_containerized | bool
+ when: is_containerized | bool