From 47c8c0b1df866b86b111e3e03b827011ec4c341c Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Tue, 31 May 2016 11:56:13 -0300 Subject: Break version calc out into a role, separate yaml for containerized/rpm. --- roles/openshift_version/tasks/main.yml | 29 ++++++++++++++++++ .../tasks/set_version_containerized.yml | 34 ++++++++++++++++++++++ roles/openshift_version/tasks/set_version_rpm.yml | 23 +++++++++++++++ 3 files changed, 86 insertions(+) create mode 100644 roles/openshift_version/tasks/main.yml create mode 100644 roles/openshift_version/tasks/set_version_containerized.yml create mode 100644 roles/openshift_version/tasks/set_version_rpm.yml (limited to 'roles/openshift_version/tasks') diff --git a/roles/openshift_version/tasks/main.yml b/roles/openshift_version/tasks/main.yml new file mode 100644 index 000000000..379809eda --- /dev/null +++ b/roles/openshift_version/tasks/main.yml @@ -0,0 +1,29 @@ +--- +# Determine the openshift_version to configure if none has been specified or set previously. + +- set_fact: + is_containerized: "{{ openshift.common.is_containerized | default(False) | bool }}" + +- debug: var=openshift_version +- debug: var=openshift_release +- debug: var=openshift_pkg_version +- debug: var=openshift_image_tag + +# Here we protect the version already installed unless something has already set +# an openshift_version to configure. +- name: Use openshift.common.version fact as version to configure if already installed + set_fact: + openshift_version: "{{ openshift.common.version }}" + when: openshift.common.version is defined and openshift_version is not defined + +- name: Set openshift_version for rpm installation + include: set_version_rpm.yml + when: not is_containerized and openshift_version is not defined + +- name: Set openshift_version for containerized installation + include: set_version_containerized.yml + when: is_containerized and openshift_version is not defined + +- debug: var=openshift_version + + diff --git a/roles/openshift_version/tasks/set_version_containerized.yml b/roles/openshift_version/tasks/set_version_containerized.yml new file mode 100644 index 000000000..0da3484a9 --- /dev/null +++ b/roles/openshift_version/tasks/set_version_containerized.yml @@ -0,0 +1,34 @@ +--- +- name: Set containerized version to configure if openshift_image_tag specified + set_fact: + openshift_version: "{{ openshift_image_tag.split('v',1)[1] }}" + when: openshift_image_tag is defined + +- name: Set containerized version to configure if openshift_release specified + set_fact: + openshift_version: "{{ openshift_release }}" + when: openshift_release is defined and openshift_version is not defined + +- name: Lookup latest containerized version if no version specified + command: > + docker run --rm {{ openshift.common.cli_image }}:latest version + register: cli_image_version + when: 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: openshift_version is not defined + +# If we got an openshift_version like "3.2", lookup the latest 3.2 container version +# and use that value instead. +- name: Set precise containerized version to configure if openshift_release specified + command: > + docker run --rm {{ openshift.common.cli_image }}:v{{ openshift_version }} version + register: cli_image_version + when: openshift_version is defined and openshift_version.split('.') | length == 2 + +- 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: openshift_version is defined and openshift_version.split('.') | length == 2 diff --git a/roles/openshift_version/tasks/set_version_rpm.yml b/roles/openshift_version/tasks/set_version_rpm.yml new file mode 100644 index 000000000..ab8f4b22f --- /dev/null +++ b/roles/openshift_version/tasks/set_version_rpm.yml @@ -0,0 +1,23 @@ +--- +# 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, + # 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 + +# We do not have as fine grained control over version to install presently with rpms, +# we just assume the user has configured the correct repos and install the rpm requested. +- name: Install latest rpm available in configured repos to check version + action: "{{ ansible_pkg_mgr }} name={{ openshift.common.service_type }}{{ openshift_version | default('') | oo_image_tag_to_rpm_version(include_dash=True) }} state=present" + when: openshift_version is not defined + +- name: Reload facts to pick up version + openshift_facts: + when: openshift_version is not defined + +- name: Set rpm version to configure to latest available in repos + set_fact: + openshift_version: "{{ openshift.common.version }}" + when: openshift_version is not defined -- cgit v1.2.3 From 87cf5935b0a480aa2b2f4333a48173ef0b44c749 Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Wed, 1 Jun 2016 12:45:05 -0300 Subject: Fix installing release 3.1 not converting to precise version. --- roles/openshift_version/tasks/main.yml | 4 ++-- roles/openshift_version/tasks/set_version_containerized.yml | 6 +++++- roles/openshift_version/tasks/set_version_rpm.yml | 2 +- 3 files changed, 8 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 379809eda..ee04ad59f 100644 --- a/roles/openshift_version/tasks/main.yml +++ b/roles/openshift_version/tasks/main.yml @@ -18,11 +18,11 @@ - name: Set openshift_version for rpm installation include: set_version_rpm.yml - when: not is_containerized and openshift_version is not defined + when: not is_containerized - name: Set openshift_version for containerized installation include: set_version_containerized.yml - when: is_containerized and openshift_version is not defined + when: is_containerized - debug: var=openshift_version diff --git a/roles/openshift_version/tasks/set_version_containerized.yml b/roles/openshift_version/tasks/set_version_containerized.yml index 0da3484a9..f3eab4831 100644 --- a/roles/openshift_version/tasks/set_version_containerized.yml +++ b/roles/openshift_version/tasks/set_version_containerized.yml @@ -2,7 +2,7 @@ - name: Set containerized version to configure if openshift_image_tag specified set_fact: openshift_version: "{{ openshift_image_tag.split('v',1)[1] }}" - when: openshift_image_tag is defined + when: openshift_image_tag is defined and openshift_version is not defined - name: Set containerized version to configure if openshift_release specified set_fact: @@ -21,6 +21,9 @@ 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: openshift_version is not defined +- debug: msg="{{ openshift_version }}" +#- debug: var=openshift_version.split('.') + # If we got an openshift_version like "3.2", lookup the latest 3.2 container version # and use that value instead. - name: Set precise containerized version to configure if openshift_release specified @@ -32,3 +35,4 @@ - 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: openshift_version is defined and openshift_version.split('.') | length == 2 + diff --git a/roles/openshift_version/tasks/set_version_rpm.yml b/roles/openshift_version/tasks/set_version_rpm.yml index ab8f4b22f..b201f24d8 100644 --- a/roles/openshift_version/tasks/set_version_rpm.yml +++ b/roles/openshift_version/tasks/set_version_rpm.yml @@ -5,7 +5,7 @@ # Expects a leading "-" in inventory, strip it off here, and ignore a 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 + when: openshift_pkg_version is defined and openshift_version is not defined # We do not have as fine grained control over version to install presently with rpms, # we just assume the user has configured the correct repos and install the rpm requested. -- cgit v1.2.3 From 88839ab89210ecd3d20d1f10f8f03bf0a801502a Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Mon, 6 Jun 2016 11:47:50 -0300 Subject: Do not install rpm for version in openshift_version role. --- .../tasks/set_version_containerized.yml | 1 - roles/openshift_version/tasks/set_version_rpm.yml | 19 +++++++++---------- 2 files changed, 9 insertions(+), 11 deletions(-) (limited to 'roles/openshift_version/tasks') diff --git a/roles/openshift_version/tasks/set_version_containerized.yml b/roles/openshift_version/tasks/set_version_containerized.yml index f3eab4831..fc15b2d35 100644 --- a/roles/openshift_version/tasks/set_version_containerized.yml +++ b/roles/openshift_version/tasks/set_version_containerized.yml @@ -22,7 +22,6 @@ when: openshift_version is not defined - debug: msg="{{ openshift_version }}" -#- debug: var=openshift_version.split('.') # If we got an openshift_version like "3.2", lookup the latest 3.2 container version # and use that value instead. diff --git a/roles/openshift_version/tasks/set_version_rpm.yml b/roles/openshift_version/tasks/set_version_rpm.yml index b201f24d8..bcf275135 100644 --- a/roles/openshift_version/tasks/set_version_rpm.yml +++ b/roles/openshift_version/tasks/set_version_rpm.yml @@ -7,17 +7,16 @@ openshift_version: "{{ openshift_pkg_version[1:].split('-')[0] }}" when: openshift_pkg_version is defined and openshift_version is not defined -# We do not have as fine grained control over version to install presently with rpms, -# we just assume the user has configured the correct repos and install the rpm requested. -- name: Install latest rpm available in configured repos to check version - action: "{{ ansible_pkg_mgr }} name={{ openshift.common.service_type }}{{ openshift_version | default('') | oo_image_tag_to_rpm_version(include_dash=True) }} state=present" +- name: Gather common package version + command: > + {{ repoquery_cmd }} --qf '%{version}' "{{ openshift.common.service_type}}" + register: common_version + failed_when: false + changed_when: false when: openshift_version is not defined -- name: Reload facts to pick up version - openshift_facts: - when: openshift_version is not defined +- debug: var=common_version -- name: Set rpm version to configure to latest available in repos - set_fact: - openshift_version: "{{ openshift.common.version }}" +- set_fact: + openshift_version: "{{ common_version.stdout | default('0.0', True) }}" when: openshift_version is not defined -- cgit v1.2.3 From dd8501ca8199484531e0a6d2b40139d4085afefa Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Tue, 7 Jun 2016 14:37:34 -0300 Subject: Force version to latest 3.2 during upgrade. --- roles/openshift_version/tasks/main.yml | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'roles/openshift_version/tasks') diff --git a/roles/openshift_version/tasks/main.yml b/roles/openshift_version/tasks/main.yml index ee04ad59f..1cfbff1b0 100644 --- a/roles/openshift_version/tasks/main.yml +++ b/roles/openshift_version/tasks/main.yml @@ -26,4 +26,8 @@ - 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. -- cgit v1.2.3 From 258ea62f3bb1bfc89eb4e676c77d1610aa067c43 Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Tue, 7 Jun 2016 15:17:28 -0300 Subject: Respect image tag/pkg version during upgrade. --- roles/openshift_version/tasks/main.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'roles/openshift_version/tasks') diff --git a/roles/openshift_version/tasks/main.yml b/roles/openshift_version/tasks/main.yml index 1cfbff1b0..39accf579 100644 --- a/roles/openshift_version/tasks/main.yml +++ b/roles/openshift_version/tasks/main.yml @@ -9,12 +9,12 @@ - debug: var=openshift_pkg_version - debug: var=openshift_image_tag -# Here we protect the version already installed unless something has already set -# an openshift_version to configure. +# Protect the installed version by default unless explicitly told not to, or given an +# openshift_version already. - name: Use openshift.common.version fact as version to configure if already installed set_fact: openshift_version: "{{ openshift.common.version }}" - when: openshift.common.version is defined and openshift_version is not defined + when: openshift.common.version is defined and openshift_version is not defined and openshift_protect_installed_version - name: Set openshift_version for rpm installation include: set_version_rpm.yml -- cgit v1.2.3 From 755a48c4ebf1061ce19892e5378fba769027bfc1 Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Fri, 10 Jun 2016 10:21:19 -0300 Subject: Fix version unset bug, and set common ver fact on containerized nodes. --- roles/openshift_version/tasks/main.yml | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'roles/openshift_version/tasks') diff --git a/roles/openshift_version/tasks/main.yml b/roles/openshift_version/tasks/main.yml index 39accf579..29724a9e5 100644 --- a/roles/openshift_version/tasks/main.yml +++ b/roles/openshift_version/tasks/main.yml @@ -4,6 +4,11 @@ - set_fact: is_containerized: "{{ openshift.common.is_containerized | default(False) | bool }}" +# Make sure we copy this to a fact if given a var: +- set_fact: + openshift_version: "{{ openshift_version }}" + when: openshift_version is defined + - debug: var=openshift_version - debug: var=openshift_release - debug: var=openshift_pkg_version -- cgit v1.2.3 From ef37abd3dd236d1c7129527a057ca2ac6377cb75 Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Mon, 13 Jun 2016 13:02:32 -0300 Subject: Fix rpm installs. --- roles/openshift_version/tasks/main.yml | 16 +++++++++------- roles/openshift_version/tasks/set_version_rpm.yml | 2 ++ 2 files changed, 11 insertions(+), 7 deletions(-) (limited to 'roles/openshift_version/tasks') diff --git a/roles/openshift_version/tasks/main.yml b/roles/openshift_version/tasks/main.yml index 29724a9e5..e27add09e 100644 --- a/roles/openshift_version/tasks/main.yml +++ b/roles/openshift_version/tasks/main.yml @@ -9,11 +9,6 @@ openshift_version: "{{ openshift_version }}" when: openshift_version is defined -- debug: var=openshift_version -- debug: var=openshift_release -- debug: var=openshift_pkg_version -- debug: var=openshift_image_tag - # Protect the installed version by default unless explicitly told not to, or given an # openshift_version already. - name: Use openshift.common.version fact as version to configure if already installed @@ -21,13 +16,20 @@ openshift_version: "{{ openshift.common.version }}" when: openshift.common.version is defined and openshift_version is not defined and openshift_protect_installed_version +- debug: var=is_containerized +- debug: var=openshift_version +- debug: msg="{{ openshift_version is defined }}" +- debug: var=openshift_release +- debug: var=openshift_pkg_version +- debug: var=openshift_image_tag + - name: Set openshift_version for rpm installation include: set_version_rpm.yml - when: not is_containerized + when: not is_containerized | bool - name: Set openshift_version for containerized installation include: set_version_containerized.yml - when: is_containerized + when: is_containerized | bool - debug: var=openshift_version diff --git a/roles/openshift_version/tasks/set_version_rpm.yml b/roles/openshift_version/tasks/set_version_rpm.yml index bcf275135..b15f0e993 100644 --- a/roles/openshift_version/tasks/set_version_rpm.yml +++ b/roles/openshift_version/tasks/set_version_rpm.yml @@ -7,6 +7,8 @@ openshift_version: "{{ openshift_pkg_version[1:].split('-')[0] }}" when: openshift_pkg_version is defined and openshift_version is not defined +- debug: var=openshift_version + - name: Gather common package version command: > {{ repoquery_cmd }} --qf '%{version}' "{{ openshift.common.service_type}}" -- cgit v1.2.3 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 From 955d295652c59f0e8ed4ddd77f50d4c6e09293a5 Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Wed, 15 Jun 2016 15:04:13 -0300 Subject: Support origin alpha tags. --- roles/openshift_version/tasks/main.yml | 1 + .../tasks/set_version_containerized.yml | 19 ++++++++++++++++--- roles/openshift_version/tasks/set_version_rpm.yml | 1 - 3 files changed, 17 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 d896eb151..ee277d1ca 100644 --- a/roles/openshift_version/tasks/main.yml +++ b/roles/openshift_version/tasks/main.yml @@ -22,6 +22,7 @@ - debug: var=openshift_release - debug: var=openshift_pkg_version - debug: var=openshift_image_tag +- debug: var=openshift.common.version - name: Set openshift_version for rpm installation include: set_version_rpm.yml diff --git a/roles/openshift_version/tasks/set_version_containerized.yml b/roles/openshift_version/tasks/set_version_containerized.yml index 6d31d0ddc..7a09c0310 100644 --- a/roles/openshift_version/tasks/set_version_containerized.yml +++ b/roles/openshift_version/tasks/set_version_containerized.yml @@ -2,7 +2,6 @@ - name: Set containerized version to configure if openshift_image_tag specified set_fact: # 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 @@ -19,12 +18,26 @@ - debug: var=cli_image_version +# Origin latest = released version (i.e. 1.2.0) - 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: openshift_version is not defined + openshift_version: "{{ cli_image_version.stdout_lines[0].split(' ')[1].split('-')[0][1:] }}" + when: openshift_version is not defined and openshift.common.deployment_type == 'origin' and cli_image_version.stdout_lines[0].split('-') | length == 0 + + +# Origin latest = pre-release version (i.e. v1.3.0-alpha.1-321-gb095e3a) +- set_fact: + openshift_version: "{{ (cli_image_version.stdout_lines[0].split(' ')[1].split('-')[0:2] | join('-'))[1:] }}" + when: openshift_version is not defined and openshift.common.deployment_type == 'origin' and cli_image_version.stdout_lines[0].split('-') | length > 1 + +# OSE +- set_fact: + openshift_version: "{{ cli_image_version.stdout_lines[0].split(' ')[1].split('-')[0][1:] }}" + when: openshift_version is not defined and openshift.common.deployment_type != 'origin' - debug: msg="{{ openshift_version }}" + + # If we got an openshift_version like "3.2", lookup the latest 3.2 container version # and use that value instead. - name: Set precise 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 90229b0e9..889ecc56c 100644 --- a/roles/openshift_version/tasks/set_version_rpm.yml +++ b/roles/openshift_version/tasks/set_version_rpm.yml @@ -3,7 +3,6 @@ - name: Set rpm version to configure if openshift_pkg_version specified set_fact: # 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 From 42dec74c57fa76e31a588b2a58f913c68825360d Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Thu, 16 Jun 2016 12:17:14 -0300 Subject: More version fixes. --- roles/openshift_version/tasks/main.yml | 1 - roles/openshift_version/tasks/set_version_containerized.yml | 9 +-------- 2 files changed, 1 insertion(+), 9 deletions(-) (limited to 'roles/openshift_version/tasks') diff --git a/roles/openshift_version/tasks/main.yml b/roles/openshift_version/tasks/main.yml index ee277d1ca..e3bdad691 100644 --- a/roles/openshift_version/tasks/main.yml +++ b/roles/openshift_version/tasks/main.yml @@ -45,7 +45,6 @@ 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 diff --git a/roles/openshift_version/tasks/set_version_containerized.yml b/roles/openshift_version/tasks/set_version_containerized.yml index 7a09c0310..d822ee164 100644 --- a/roles/openshift_version/tasks/set_version_containerized.yml +++ b/roles/openshift_version/tasks/set_version_containerized.yml @@ -18,21 +18,14 @@ - debug: var=cli_image_version -# Origin latest = released version (i.e. 1.2.0) -- set_fact: - openshift_version: "{{ cli_image_version.stdout_lines[0].split(' ')[1].split('-')[0][1:] }}" - when: openshift_version is not defined and openshift.common.deployment_type == 'origin' and cli_image_version.stdout_lines[0].split('-') | length == 0 - - # Origin latest = pre-release version (i.e. v1.3.0-alpha.1-321-gb095e3a) - set_fact: openshift_version: "{{ (cli_image_version.stdout_lines[0].split(' ')[1].split('-')[0:2] | join('-'))[1:] }}" when: openshift_version is not defined and openshift.common.deployment_type == 'origin' and cli_image_version.stdout_lines[0].split('-') | length > 1 -# OSE - set_fact: openshift_version: "{{ cli_image_version.stdout_lines[0].split(' ')[1].split('-')[0][1:] }}" - when: openshift_version is not defined and openshift.common.deployment_type != 'origin' + when: openshift_version is not defined - debug: msg="{{ openshift_version }}" -- cgit v1.2.3 From e60b8976ef638c3368dd229906078f1077f00a99 Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Fri, 17 Jun 2016 09:10:39 -0300 Subject: Block attempts to install origin without specifying any release info. --- roles/openshift_version/tasks/main.yml | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'roles/openshift_version/tasks') diff --git a/roles/openshift_version/tasks/main.yml b/roles/openshift_version/tasks/main.yml index e3bdad691..9ff13d35c 100644 --- a/roles/openshift_version/tasks/main.yml +++ b/roles/openshift_version/tasks/main.yml @@ -1,6 +1,13 @@ --- # Determine the openshift_version to configure if none has been specified or set previously. +# Block attempts to install origin without specifying some kind of version information. +# This is because the latest tags for origin are usually alpha builds, which should not +# be used by default. Users must indicate what they want. +- fail: + msg: "Must specify openshift_release, openshift_image_tag, or openshift_pkg_version in inventory to install origin. (suggestion: add openshift_release=\"1.2\" to inventory)" + when: openshift.common.deployment_type == 'origin' and openshift_release is not defined and openshift_pkg_version is not defined and openshift_image_tag is not defined + - set_fact: is_containerized: "{{ openshift.common.is_containerized | default(False) | bool }}" -- cgit v1.2.3 From dc75bf3a6c7913c519706e69a3ea82efd191b378 Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Fri, 17 Jun 2016 10:48:38 -0300 Subject: Check that detected version matches openshift_release in rpm installations. --- roles/openshift_version/tasks/main.yml | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'roles/openshift_version/tasks') diff --git a/roles/openshift_version/tasks/main.yml b/roles/openshift_version/tasks/main.yml index 9ff13d35c..b11bf62fe 100644 --- a/roles/openshift_version/tasks/main.yml +++ b/roles/openshift_version/tasks/main.yml @@ -1,15 +1,15 @@ --- # Determine the openshift_version to configure if none has been specified or set previously. +- set_fact: + is_containerized: "{{ openshift.common.is_containerized | default(False) | bool }}" + # Block attempts to install origin without specifying some kind of version information. # This is because the latest tags for origin are usually alpha builds, which should not # be used by default. Users must indicate what they want. - fail: - msg: "Must specify openshift_release, openshift_image_tag, or openshift_pkg_version in inventory to install origin. (suggestion: add openshift_release=\"1.2\" to inventory)" - when: openshift.common.deployment_type == 'origin' and openshift_release is not defined and openshift_pkg_version is not defined and openshift_image_tag is not defined - -- set_fact: - is_containerized: "{{ openshift.common.is_containerized | default(False) | bool }}" + msg: "Must specify openshift_release or openshift_image_tag in inventory to install origin. (suggestion: add openshift_release=\"1.2\" to inventory)" + when: is_containerized | bool and openshift.common.deployment_type == 'origin' and openshift_release is not defined and openshift_image_tag is not defined # Make sure we copy this to a fact if given a var: - set_fact: @@ -65,3 +65,8 @@ - fail: openshift_version role was unable to set openshift_pkg_version when: openshift_pkg_version is not defined +# We can't map an openshift_release to full rpm version like we can with containers, make sure +# the rpm version we looked up matches the release requested and error out if not. +- fail: + msg: "Detected openshift version {{ openshift_version }} does not match requested openshift_release {{ openshift_release }}. You may need to adjust your yum repositories or specify an exact openshift_pkg_version." + when: not is_containerized | bool and openshift_release is defined and not openshift_version | oo_startswith(openshift_release) | bool -- cgit v1.2.3 From 2cab796e15d834dfb9f3743941dd5311731fc70f Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Fri, 17 Jun 2016 10:54:14 -0300 Subject: Normalize some of the version inventory vars which users might mistakenly enter wrong. --- roles/openshift_version/tasks/main.yml | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'roles/openshift_version/tasks') diff --git a/roles/openshift_version/tasks/main.yml b/roles/openshift_version/tasks/main.yml index b11bf62fe..ac3efe7e9 100644 --- a/roles/openshift_version/tasks/main.yml +++ b/roles/openshift_version/tasks/main.yml @@ -11,6 +11,19 @@ msg: "Must specify openshift_release or openshift_image_tag in inventory to install origin. (suggestion: add openshift_release=\"1.2\" to inventory)" when: is_containerized | bool and openshift.common.deployment_type == 'origin' and openshift_release is not defined and openshift_image_tag is not defined +# Normalize some values that we need in a certain format that might be confusing: +- set_fact: + openshift_release: "{{ openshift_release[1:] }}" + when: openshift_release is defined and openshift_release[0] == 'v' + +- set_fact: + openshift_image_tag: "{{ 'v' + openshift_image_tag }}" + when: openshift_image_tag is defined and openshift_image_tag[0] != 'v' + +- set_fact: + openshift_pkg_version: "{{ '-' + openshift_pkg_version }}" + when: openshift_pkg_version is defined and openshift_pkg_version[0] != '-' + # Make sure we copy this to a fact if given a var: - set_fact: openshift_version: "{{ openshift_version }}" -- cgit v1.2.3 From 0071ab46bf9ae73bbb09c9fa0c9eb8a342a81ba1 Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Mon, 4 Jul 2016 10:08:36 -0300 Subject: Fix unsafe bool usage. --- roles/openshift_version/tasks/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'roles/openshift_version/tasks') diff --git a/roles/openshift_version/tasks/main.yml b/roles/openshift_version/tasks/main.yml index ac3efe7e9..8cd66cbe9 100644 --- a/roles/openshift_version/tasks/main.yml +++ b/roles/openshift_version/tasks/main.yml @@ -34,7 +34,7 @@ - name: Use openshift.common.version fact as version to configure if already installed set_fact: openshift_version: "{{ openshift.common.version }}" - when: openshift.common.version is defined and openshift_version is not defined and openshift_protect_installed_version + when: openshift.common.version is defined and openshift_version is not defined and openshift_protect_installed_version | bool - debug: var=is_containerized - debug: var=openshift_version -- cgit v1.2.3 From cf737735ffdbc2a83d03361e57538a5bff903f6f Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Mon, 4 Jul 2016 12:52:06 -0300 Subject: Fixes for Ansible 2.1. --- roles/openshift_version/tasks/main.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'roles/openshift_version/tasks') diff --git a/roles/openshift_version/tasks/main.yml b/roles/openshift_version/tasks/main.yml index 8cd66cbe9..a27ddeaee 100644 --- a/roles/openshift_version/tasks/main.yml +++ b/roles/openshift_version/tasks/main.yml @@ -69,13 +69,16 @@ - debug: var=openshift_pkg_version - debug: var=openshift_image_tag -- fail: openshift_version role was unable to set openshift_version +- fail: + msg: 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 +- fail: + msg: 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 +- fail: + msg: openshift_version role was unable to set openshift_pkg_version when: openshift_pkg_version is not defined # We can't map an openshift_release to full rpm version like we can with containers, make sure -- cgit v1.2.3 From 5628e0ce7c86efd47f11310dee204f4a4a8dfc04 Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Fri, 8 Jul 2016 11:43:25 -0300 Subject: Remove all debug used during devel of openshift_version. --- roles/openshift_version/tasks/main.yml | 12 ------------ roles/openshift_version/tasks/set_version_containerized.yml | 6 ------ roles/openshift_version/tasks/set_version_rpm.yml | 4 ---- 3 files changed, 22 deletions(-) (limited to 'roles/openshift_version/tasks') diff --git a/roles/openshift_version/tasks/main.yml b/roles/openshift_version/tasks/main.yml index a27ddeaee..b4f3fb36d 100644 --- a/roles/openshift_version/tasks/main.yml +++ b/roles/openshift_version/tasks/main.yml @@ -36,14 +36,6 @@ openshift_version: "{{ openshift.common.version }}" when: openshift.common.version is defined and openshift_version is not defined and openshift_protect_installed_version | bool -- debug: var=is_containerized -- debug: var=openshift_version -- debug: msg="{{ openshift_version is defined }}" -- debug: var=openshift_release -- debug: var=openshift_pkg_version -- debug: var=openshift_image_tag -- debug: var=openshift.common.version - - name: Set openshift_version for rpm installation include: set_version_rpm.yml when: not is_containerized | bool @@ -65,10 +57,6 @@ openshift_pkg_version: -{{ openshift_version }} when: openshift_pkg_version is not defined -- debug: var=openshift_version -- debug: var=openshift_pkg_version -- debug: var=openshift_image_tag - - fail: msg: openshift_version role was unable to set openshift_version when: openshift_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 d822ee164..8e2702391 100644 --- a/roles/openshift_version/tasks/set_version_containerized.yml +++ b/roles/openshift_version/tasks/set_version_containerized.yml @@ -16,8 +16,6 @@ register: cli_image_version when: openshift_version is not defined -- debug: var=cli_image_version - # Origin latest = pre-release version (i.e. v1.3.0-alpha.1-321-gb095e3a) - set_fact: openshift_version: "{{ (cli_image_version.stdout_lines[0].split(' ')[1].split('-')[0:2] | join('-'))[1:] }}" @@ -27,10 +25,6 @@ openshift_version: "{{ cli_image_version.stdout_lines[0].split(' ')[1].split('-')[0][1:] }}" when: openshift_version is not defined -- debug: msg="{{ openshift_version }}" - - - # If we got an openshift_version like "3.2", lookup the latest 3.2 container version # and use that value instead. - name: Set precise 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 889ecc56c..cf0a3b51f 100644 --- a/roles/openshift_version/tasks/set_version_rpm.yml +++ b/roles/openshift_version/tasks/set_version_rpm.yml @@ -6,8 +6,6 @@ openshift_version: "{{ openshift_pkg_version[1:].split('-')[0] }}" when: openshift_pkg_version is defined and openshift_version is not defined -- debug: var=openshift_version - - name: Gather common package version command: > {{ repoquery_cmd }} --qf '%{version}' "{{ openshift.common.service_type}}" @@ -16,8 +14,6 @@ changed_when: false when: openshift_version is not defined -- debug: var=common_version - - set_fact: openshift_version: "{{ common_version.stdout | default('0.0', True) }}" when: openshift_version is not defined -- cgit v1.2.3 From 2a8b144073f474bf966c6ab92329442a1a526bde Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Fri, 8 Jul 2016 11:48:12 -0300 Subject: Remove/update TODOs. --- roles/openshift_version/tasks/set_version_rpm.yml | 1 - 1 file changed, 1 deletion(-) (limited to 'roles/openshift_version/tasks') diff --git a/roles/openshift_version/tasks/set_version_rpm.yml b/roles/openshift_version/tasks/set_version_rpm.yml index cf0a3b51f..7fa74e24f 100644 --- a/roles/openshift_version/tasks/set_version_rpm.yml +++ b/roles/openshift_version/tasks/set_version_rpm.yml @@ -1,5 +1,4 @@ --- -# 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 remove trailing release, -- cgit v1.2.3 From 02d4470e1ff26350a2e02567246627aaf09455eb Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Mon, 11 Jul 2016 10:08:14 -0300 Subject: Use proper startswith. --- roles/openshift_version/tasks/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'roles/openshift_version/tasks') diff --git a/roles/openshift_version/tasks/main.yml b/roles/openshift_version/tasks/main.yml index b4f3fb36d..2d96d2765 100644 --- a/roles/openshift_version/tasks/main.yml +++ b/roles/openshift_version/tasks/main.yml @@ -73,4 +73,4 @@ # the rpm version we looked up matches the release requested and error out if not. - fail: msg: "Detected openshift version {{ openshift_version }} does not match requested openshift_release {{ openshift_release }}. You may need to adjust your yum repositories or specify an exact openshift_pkg_version." - when: not is_containerized | bool and openshift_release is defined and not openshift_version | oo_startswith(openshift_release) | bool + when: not is_containerized | bool and openshift_release is defined and not openshift_version.startswith(openshift_release) | bool -- cgit v1.2.3