diff options
Diffstat (limited to 'playbooks/common')
5 files changed, 63 insertions, 4 deletions
diff --git a/playbooks/common/openshift-cluster/config.yml b/playbooks/common/openshift-cluster/config.yml index 5fec11541..5cf5df08e 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 + diff --git a/playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/pre.yml b/playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/pre.yml index dd9843290..84b7c817b 100644 --- a/playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/pre.yml +++ b/playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/pre.yml @@ -125,6 +125,8 @@ register: g_rpm_versions_result when: not openshift.common.is_containerized | bool + - debug: var=g_rpm_versions_result + - set_fact: g_aos_versions: "{{ g_rpm_versions_result.stdout | from_yaml }}" when: not openshift.common.is_containerized | bool diff --git a/playbooks/common/openshift-master/config.yml b/playbooks/common/openshift-master/config.yml index e9337270b..c6fac2870 100644 --- a/playbooks/common/openshift-master/config.yml +++ b/playbooks/common/openshift-master/config.yml @@ -231,12 +231,19 @@ with_items: openshift_master_named_certificates when: named_certs_specified | bool -- name: Configure master instances +- name: Configure masters hosts: oo_masters_to_config any_errors_fatal: true serial: 1 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) + # 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] }}" + when: inventory_hostname != groups.oo_first_master.0 + openshift_master_ha: "{{ openshift.master.ha }}" openshift_master_count: "{{ openshift.master.master_count }}" openshift_master_session_auth_secrets: "{{ hostvars[groups.oo_first_master.0].openshift.master.session_auth_secrets }}" @@ -247,7 +254,7 @@ | union(groups['oo_etcd_to_config'] | default([]))) | oo_collect('openshift.common.hostname') | default([]) | join (',') }}" - when: "{{ (openshift_http_proxy is defined or openshift_https_proxy is defined) and + when: "{{ (openshift_http_proxy is defined or openshift_https_proxy is defined) and openshift_generate_no_proxy_hosts | default(True) | bool }}" roles: - role: openshift_master diff --git a/playbooks/common/openshift-node/config.yml b/playbooks/common/openshift-node/config.yml index 6fbf7d44a..9c9aa779a 100644 --- a/playbooks/common/openshift-node/config.yml +++ b/playbooks/common/openshift-node/config.yml @@ -45,6 +45,22 @@ with_items: "{{ groups.oo_nodes_to_config | default([]) }}" when: hostvars[item].openshift.common.is_containerized | bool and (item in groups.oo_nodes_to_config and item in groups.oo_masters_to_config) +- name: Determine openshift_version to install on nodes + hosts: oo_nodes_to_config + any_errors_fatal: true + tasks: + - debug: var=hostvars[groups.oo_first_master.0].openshift.common.version + - debug: var=openshift.common.version + - name: Set openshift_version to match first master for new node + set_fact: + openshift_version: "{{ hostvars[groups.oo_first_master.0].openshift.common.version }}" + when: openshift.common.version is not defined + - name: Set openshift_version to currently installed version + set_fact: + openshift_version: "{{ openshift.common.version }}" + when: openshift.common.version is defined + - debug: var=openshift_version + - name: Configure node instances hosts: oo_containerized_master_nodes serial: 1 @@ -57,7 +73,7 @@ | union(groups['oo_etcd_to_config'] | default([]))) | oo_collect('openshift.common.hostname') | default([]) | join (',') }}" - when: "{{ (openshift_http_proxy is defined or openshift_https_proxy is defined) and + when: "{{ (openshift_http_proxy is defined or openshift_https_proxy is defined) and openshift_generate_no_proxy_hosts | default(True) | bool }}" roles: - role: openshift_node @@ -74,7 +90,7 @@ | union(groups['oo_etcd_to_config'] | default([]))) | oo_collect('openshift.common.hostname') | default([]) | join (',') }}" - when: "{{ (openshift_http_proxy is defined or openshift_https_proxy is defined) and + when: "{{ (openshift_http_proxy is defined or openshift_https_proxy is defined) and openshift_generate_no_proxy_hosts | default(True) | bool }}" roles: - role: openshift_node |