From a836a35b63ff1476eca5a8545a6c11ab389026d0 Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Tue, 14 Jun 2016 09:06:39 -0300 Subject: Always populate openshift_image_tag and openshift_pkg_version. Allows the use of arbitrary tags, precise control over containers and rpms, and likely mixed environments. --- roles/openshift_version/tasks/main.yml | 24 ++++++++++++++++++++-- .../tasks/set_version_containerized.yml | 4 +++- roles/openshift_version/tasks/set_version_rpm.yml | 2 +- 3 files changed, 26 insertions(+), 4 deletions(-) (limited to 'roles/openshift_version/tasks') diff --git a/roles/openshift_version/tasks/main.yml b/roles/openshift_version/tasks/main.yml index e27add09e..d896eb151 100644 --- a/roles/openshift_version/tasks/main.yml +++ b/roles/openshift_version/tasks/main.yml @@ -31,10 +31,30 @@ include: set_version_containerized.yml when: is_containerized | bool -- debug: var=openshift_version - # At this point we know openshift_version is set appropriately. Now we set # openshift_image_tag and openshift_pkg_version, so all roles can always assume # each of this variables *will* be set correctly and can use them per their # intended purpose. +- set_fact: + openshift_image_tag: v{{ openshift_version }} + when: openshift_image_tag is not defined + +- set_fact: + openshift_pkg_version: -{{ openshift_version }} + when: openshift_pkg_version is not defined + +# TODO: fail if any of these is unset or looks wrong: +- debug: var=openshift_version +- debug: var=openshift_pkg_version +- debug: var=openshift_image_tag + +- fail: openshift_version role was unable to set openshift_version + when: openshift_version is not defined + +- fail: openshift_version role was unable to set openshift_image_tag + when: openshift_image_tag is not defined + +- fail: openshift_version role was unable to set openshift_pkg_version + when: openshift_pkg_version is not defined + diff --git a/roles/openshift_version/tasks/set_version_containerized.yml b/roles/openshift_version/tasks/set_version_containerized.yml index fc15b2d35..6d31d0ddc 100644 --- a/roles/openshift_version/tasks/set_version_containerized.yml +++ b/roles/openshift_version/tasks/set_version_containerized.yml @@ -1,7 +1,9 @@ --- - name: Set containerized version to configure if openshift_image_tag specified set_fact: - openshift_version: "{{ openshift_image_tag.split('v',1)[1] }}" + # Expects a leading "v" in inventory, strip it off here: + # openshift_version should always just be "3.2" or "3.2.0.44" + openshift_version: "{{ openshift_image_tag[1:].split('-')[0] }}" when: openshift_image_tag is defined and openshift_version is not defined - name: Set containerized version to configure if openshift_release specified diff --git a/roles/openshift_version/tasks/set_version_rpm.yml b/roles/openshift_version/tasks/set_version_rpm.yml index b15f0e993..90229b0e9 100644 --- a/roles/openshift_version/tasks/set_version_rpm.yml +++ b/roles/openshift_version/tasks/set_version_rpm.yml @@ -2,7 +2,7 @@ # TODO: support openshift_release here? - name: Set rpm version to configure if openshift_pkg_version specified set_fact: - # Expects a leading "-" in inventory, strip it off here, and ignore a trailing release, + # Expects a leading "-" in inventory, strip it off here, and remove trailing release, # openshift_version should always just be "3.2" or "3.2.0.44" openshift_version: "{{ openshift_pkg_version[1:].split('-')[0] }}" when: openshift_pkg_version is defined and openshift_version is not defined -- cgit v1.2.3