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. --- .../initialize_openshift_version.yml | 4 ---- playbooks/common/openshift-master/config.yml | 2 +- roles/openshift_common/meta/main.yml | 3 ++- roles/openshift_common/tasks/main.yml | 11 +++++++++++ .../tasks/set_version_containerized.yml | 1 - roles/openshift_version/tasks/set_version_rpm.yml | 19 +++++++++---------- 6 files changed, 23 insertions(+), 17 deletions(-) diff --git a/playbooks/common/openshift-cluster/initialize_openshift_version.yml b/playbooks/common/openshift-cluster/initialize_openshift_version.yml index 75452f41d..88ec7840b 100644 --- a/playbooks/common/openshift-cluster/initialize_openshift_version.yml +++ b/playbooks/common/openshift-cluster/initialize_openshift_version.yml @@ -3,14 +3,10 @@ - name: Determine openshift_version to configure on first master hosts: oo_first_master roles: - # Using the CLI role here to install the CLI tool/wrapper, and set the - # openshift.common.version fact which other hosts can then reference. - openshift_version pre_tasks: - - debug: var=openshift.common.version - debug: var=openshift_version post_tasks: - - debug: var=openshift.common.version - debug: var=openshift_version # NOTE: We set this even on etcd hosts as they may also later run as masters, diff --git a/playbooks/common/openshift-master/config.yml b/playbooks/common/openshift-master/config.yml index 8ed62a7f1..7ab046e04 100644 --- a/playbooks/common/openshift-master/config.yml +++ b/playbooks/common/openshift-master/config.yml @@ -317,7 +317,7 @@ vars: sync_tmpdir: "{{ hostvars.localhost.g_master_mktemp.stdout }}" - # Do not pass a version if this is first master. (openshift_docker will sort it out) + # Do not pass a version if this is first master. (openshift_version will sort it out) # For subsequent masters we pass either pre-existing version for the master (if already installed), # otherwise the first master version. openshift_version: "{{ openshift.common.version if openshift.common.version is defined else oo_first_master.openshift.common.version.split('-')[0] }}" diff --git a/roles/openshift_common/meta/main.yml b/roles/openshift_common/meta/main.yml index d3f8a343f..cd8c75ec5 100644 --- a/roles/openshift_common/meta/main.yml +++ b/roles/openshift_common/meta/main.yml @@ -13,4 +13,5 @@ galaxy_info: - cloud dependencies: - role: openshift_facts -- role: openshift_docker +- role: openshift_repos +- role: openshift_version diff --git a/roles/openshift_common/tasks/main.yml b/roles/openshift_common/tasks/main.yml index d548daae6..4ec255dbc 100644 --- a/roles/openshift_common/tasks/main.yml +++ b/roles/openshift_common/tasks/main.yml @@ -29,6 +29,17 @@ data_dir: "{{ openshift_data_dir | default(None) }}" use_dnsmasq: "{{ openshift_use_dnsmasq | default(None) }}" +# Using oo_image_tag_to_rpm_version here is a workaround for how +# openshift_version is set. That value is computed based on either RPM +# versions or image tags. openshift_common's usage requires that it be a RPM +# version and openshift_cli expects it to be an image tag. +- name: Install the base package for versioning + action: "{{ ansible_pkg_mgr }} name={{ openshift.common.service_type }}{{ openshift_version | default('') | oo_image_tag_to_rpm_version(include_dash=True) }} state=present" + when: not openshift.common.is_containerized | bool + +- name: Set version facts + openshift_facts: + # For enterprise versions < 3.1 and origin versions < 1.1 we want to set the # hostname by default. - set_fact: 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