From 0c7433838c8c6409b8de907fcc946fc73fe90527 Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Tue, 24 May 2016 09:46:33 -0300 Subject: Work towards determining openshift_version when unspecified. openshift_docker role was largely useless now, but also almost did what we needed. (deps ordering still needs to be changed) Remove defaulting of openshift_version. --- roles/openshift_docker/tasks/main.yml | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'roles/openshift_docker/tasks') diff --git a/roles/openshift_docker/tasks/main.yml b/roles/openshift_docker/tasks/main.yml index aaa472727..2ab31de8b 100644 --- a/roles/openshift_docker/tasks/main.yml +++ b/roles/openshift_docker/tasks/main.yml @@ -4,7 +4,20 @@ # openshift_image_tag correctly for upgrades. - 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 }}" + +# If no openshift_version provided, figure out what to use: +# TODO: May want to move this to another role. +- name: Lookup latest OpenShift version if none specified + command: > + docker run --rm {{ openshift.common.cli_image }}:latest version + register: cli_image_version + when: is_containerized | bool and openshift_version is not defined + +- debug: var=cli_image_version + +- set_fact: + openshift_version: "{{ cli_image_version.stdout_lines[0].split(' ')[1].split('-')[0:2][1:] | join('-') if openshift.common.deployment_type == 'origin' else cli_image_version.stdout_lines[0].split(' ')[1].split('-')[0][1:] }}" + when: is_containerized | bool and openshift_version is not defined + +- debug: var=openshift_version -- cgit v1.2.3