summaryrefslogtreecommitdiffstats
path: root/roles/openshift_docker/tasks
diff options
context:
space:
mode:
authorDevan Goodwin <dgoodwin@redhat.com>2016-05-30 11:52:48 -0300
committerDevan Goodwin <dgoodwin@redhat.com>2016-05-30 12:40:38 -0300
commit265daf6b65206fc17ad35e682640477d08efbc43 (patch)
tree00ab31be599ac56a78121366a76c04fc42d13629 /roles/openshift_docker/tasks
parent3f7ac81838d0cef4ea95505abf82be7e114ae415 (diff)
downloadopenshift-265daf6b65206fc17ad35e682640477d08efbc43.tar.gz
openshift-265daf6b65206fc17ad35e682640477d08efbc43.tar.bz2
openshift-265daf6b65206fc17ad35e682640477d08efbc43.tar.xz
openshift-265daf6b65206fc17ad35e682640477d08efbc43.zip
Refactor openshift_version behavior.
Very early in playbooks we must init the openshift_version for each host. First we determine it for the master, logic now is pushed into the openshift_docker role which we run only on first master via openshift_cli. Facts are reloaded leaving us with a first master with openshift.common.version fact we can then re-use on all other hosts. The correct version of docker should be installed as well. We then set openshift_version for all other hosts by re-using the master fact.
Diffstat (limited to 'roles/openshift_docker/tasks')
-rw-r--r--roles/openshift_docker/tasks/main.yml29
1 files changed, 27 insertions, 2 deletions
diff --git a/roles/openshift_docker/tasks/main.yml b/roles/openshift_docker/tasks/main.yml
index c7b8f504a..c2ba63a1d 100644
--- a/roles/openshift_docker/tasks/main.yml
+++ b/roles/openshift_docker/tasks/main.yml
@@ -11,9 +11,24 @@
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
# RPM openshift_version setup:
-- debug: msg="{{ openshift_version | default('') | oo_image_tag_to_rpm_version(include_dash=True) }}"
+# TODO: support openshift_release here:
+- name: Determine rpm version to configure when 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: not is_containerized | bool and openshift_pkg_version is defined and openshift_version is not defined
+
+- 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: Lookup latest OpenShift rpm version if none specified
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 is_containerized | bool and openshift_version is not defined
@@ -26,9 +41,18 @@
openshift_version: "{{ openshift.common.version }}"
when: not is_containerized | bool and openshift_version is not defined
-# TODO: What to do if openshift_version = 3.2 for rpm based installs?
# Containerized openshift_version setup:
+- name: Determine version to configure if containerized and release specified
+ set_fact:
+ openshift_version: "{{ openshift_release }}"
+ when: is_containerized | bool and openshift_release is defined and openshift_version is not defined
+
+- name: Determine container version to configure when openshift_image_tag specified
+ set_fact:
+ openshift_version: "{{ openshift_image_tag.split('v',1)[1] }}"
+ when: is_containerized | bool and openshift_image_tag is defined and openshift_version is not defined
+
- name: Lookup latest containerized OpenShift version if none specified
command: >
docker run --rm {{ openshift.common.cli_image }}:latest version
@@ -53,5 +77,6 @@
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 defined and openshift_version.split('.') | length == 2
+
- debug: var=openshift_version