summaryrefslogtreecommitdiffstats
path: root/playbooks/common/openshift-cluster
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 /playbooks/common/openshift-cluster
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 'playbooks/common/openshift-cluster')
-rw-r--r--playbooks/common/openshift-cluster/config.yml2
-rw-r--r--playbooks/common/openshift-cluster/initialize_openshift_version.yml32
2 files changed, 34 insertions, 0 deletions
diff --git a/playbooks/common/openshift-cluster/config.yml b/playbooks/common/openshift-cluster/config.yml
index 903babc45..b2f09d58d 100644
--- a/playbooks/common/openshift-cluster/config.yml
+++ b/playbooks/common/openshift-cluster/config.yml
@@ -5,6 +5,8 @@
- include: validate_hostnames.yml
+- include: initialize_openshift_version.yml
+
- name: Set oo_options
hosts: oo_all_hosts
tasks:
diff --git a/playbooks/common/openshift-cluster/initialize_openshift_version.yml b/playbooks/common/openshift-cluster/initialize_openshift_version.yml
new file mode 100644
index 000000000..85ad52b22
--- /dev/null
+++ b/playbooks/common/openshift-cluster/initialize_openshift_version.yml
@@ -0,0 +1,32 @@
+---
+# NOTE: requires openshift_facts be run
+- 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_cli
+ 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,
+# and we don't want to install wrong version of docker and have to downgrade
+# later.
+- name: Set openshift_version for all hosts
+ hosts: oo_all_hosts
+ tasks:
+ - debug: var=hostvars[groups.oo_first_master.0].openshift.common.version
+ - debug: var=openshift.common.version
+ - debug: var=openshift_version
+ # TODO: Should we use the first master's "openshift_version" var instead of a fact? Could go to just openshift_docker role above, and skip CLI config this early.
+ - set_fact:
+ openshift_version: "{{ openshift.common.version if openshift.common.version is defined else hostvars[groups.oo_first_master.0].openshift.common.version.split('-')[0] }}"
+ when: inventory_hostname != groups.oo_first_master.0
+ - debug: var=hostvars[groups.oo_first_master.0].openshift.common.version
+ - debug: var=openshift.common.version
+ - debug: var=openshift_version
+