From 265daf6b65206fc17ad35e682640477d08efbc43 Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Mon, 30 May 2016 11:52:48 -0300 Subject: 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. --- .../initialize_openshift_version.yml | 32 ++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 playbooks/common/openshift-cluster/initialize_openshift_version.yml (limited to 'playbooks/common/openshift-cluster/initialize_openshift_version.yml') 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 + -- cgit v1.2.3 From a5a736f4042abca402f7648a830968c205163a34 Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Tue, 31 May 2016 13:39:16 -0300 Subject: Stop requiring/using first master version fact and use openshift_version var instead. --- .../common/openshift-cluster/initialize_openshift_version.yml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'playbooks/common/openshift-cluster/initialize_openshift_version.yml') diff --git a/playbooks/common/openshift-cluster/initialize_openshift_version.yml b/playbooks/common/openshift-cluster/initialize_openshift_version.yml index 85ad52b22..75452f41d 100644 --- a/playbooks/common/openshift-cluster/initialize_openshift_version.yml +++ b/playbooks/common/openshift-cluster/initialize_openshift_version.yml @@ -5,7 +5,7 @@ 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 + - openshift_version pre_tasks: - debug: var=openshift.common.version - debug: var=openshift_version @@ -19,14 +19,13 @@ - 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=hostvars[groups.oo_first_master.0].openshift_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] }}" + openshift_version: "{{ openshift.common.version if openshift.common.version is defined else hostvars[groups.oo_first_master.0].openshift_version }}" when: inventory_hostname != groups.oo_first_master.0 - - debug: var=hostvars[groups.oo_first_master.0].openshift.common.version + - debug: var=hostvars[groups.oo_first_master.0].openshift_version - debug: var=openshift.common.version - debug: var=openshift_version -- 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. --- playbooks/common/openshift-cluster/initialize_openshift_version.yml | 4 ---- 1 file changed, 4 deletions(-) (limited to 'playbooks/common/openshift-cluster/initialize_openshift_version.yml') 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, -- 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. --- playbooks/common/openshift-cluster/initialize_openshift_version.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'playbooks/common/openshift-cluster/initialize_openshift_version.yml') diff --git a/playbooks/common/openshift-cluster/initialize_openshift_version.yml b/playbooks/common/openshift-cluster/initialize_openshift_version.yml index 88ec7840b..098558c01 100644 --- a/playbooks/common/openshift-cluster/initialize_openshift_version.yml +++ b/playbooks/common/openshift-cluster/initialize_openshift_version.yml @@ -19,7 +19,7 @@ - debug: var=openshift.common.version - debug: var=openshift_version - set_fact: - openshift_version: "{{ openshift.common.version if openshift.common.version is defined else hostvars[groups.oo_first_master.0].openshift_version }}" + openshift_version: "{{ openshift.common.version if (openshift.common.version is defined and openshift_version is not defined) else hostvars[groups.oo_first_master.0].openshift_version }}" when: inventory_hostname != groups.oo_first_master.0 - debug: var=hostvars[groups.oo_first_master.0].openshift_version - debug: var=openshift.common.version -- 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. --- .../openshift-cluster/initialize_openshift_version.yml | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'playbooks/common/openshift-cluster/initialize_openshift_version.yml') diff --git a/playbooks/common/openshift-cluster/initialize_openshift_version.yml b/playbooks/common/openshift-cluster/initialize_openshift_version.yml index 098558c01..972df050c 100644 --- a/playbooks/common/openshift-cluster/initialize_openshift_version.yml +++ b/playbooks/common/openshift-cluster/initialize_openshift_version.yml @@ -13,14 +13,16 @@ # 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: + hosts: oo_all_hosts:!oo_first_master + vars: + openshift_version: "{{ hostvars[groups.oo_first_master.0].openshift_version }}" + roles: + - openshift_version + pre_tasks: - debug: var=hostvars[groups.oo_first_master.0].openshift_version - debug: var=openshift.common.version - debug: var=openshift_version - - set_fact: - openshift_version: "{{ openshift.common.version if (openshift.common.version is defined and openshift_version is not defined) else hostvars[groups.oo_first_master.0].openshift_version }}" - when: inventory_hostname != groups.oo_first_master.0 + post_tasks: - debug: var=hostvars[groups.oo_first_master.0].openshift_version - debug: var=openshift.common.version - debug: var=openshift_version -- 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. --- .../openshift-cluster/initialize_openshift_version.yml | 13 ------------- 1 file changed, 13 deletions(-) (limited to 'playbooks/common/openshift-cluster/initialize_openshift_version.yml') diff --git a/playbooks/common/openshift-cluster/initialize_openshift_version.yml b/playbooks/common/openshift-cluster/initialize_openshift_version.yml index 972df050c..7112a6084 100644 --- a/playbooks/common/openshift-cluster/initialize_openshift_version.yml +++ b/playbooks/common/openshift-cluster/initialize_openshift_version.yml @@ -4,10 +4,6 @@ hosts: oo_first_master roles: - openshift_version - pre_tasks: - - debug: var=openshift_version - post_tasks: - - 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 @@ -18,12 +14,3 @@ openshift_version: "{{ hostvars[groups.oo_first_master.0].openshift_version }}" roles: - openshift_version - pre_tasks: - - debug: var=hostvars[groups.oo_first_master.0].openshift_version - - debug: var=openshift.common.version - - debug: var=openshift_version - post_tasks: - - debug: var=hostvars[groups.oo_first_master.0].openshift_version - - debug: var=openshift.common.version - - debug: var=openshift_version - -- cgit v1.2.3