From c45562e0e03e03c82bfcf60d4b3f8b7793133301 Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Fri, 20 May 2016 15:14:28 -0300 Subject: Set openshift_version in config playbooks for first master. Starting to remove openshift.docker.openshift_version fact usage. openshift_version should no longer contain a leading 'v' for containerized installs, just a version number. --- playbooks/common/openshift-master/config.yml | 72 ++++++++++++++++++++++++++-- 1 file changed, 69 insertions(+), 3 deletions(-) (limited to 'playbooks/common') diff --git a/playbooks/common/openshift-master/config.yml b/playbooks/common/openshift-master/config.yml index 125aab0ae..17afbb48c 100644 --- a/playbooks/common/openshift-master/config.yml +++ b/playbooks/common/openshift-master/config.yml @@ -156,6 +156,29 @@ - master.etcd-ca.crt when: etcd_client_certs_missing is defined and etcd_client_certs_missing +# Must be run before generating master certs which involved openshift_cli role and needs +# to pull down the correct docker container: +- name: Determine openshift_version to install on first master + hosts: oo_first_master + any_errors_fatal: true + tasks: + - debug: var=openshift.common + - debug: var=openshift_image_tag + - debug: var=openshift_release + - name: Determine version to configure if containerized and release specified + set_fact: + openshift_version: "{{ openshift_release }}" + when: openshift.common.is_containerized | bool and openshift_release is defined + - name: Determine version to configure if containerized and image tag specified + set_fact: + openshift_version: "{{ openshift_image_tag.split('v',1)[1] }}" + when: openshift.common.is_containerized | bool and openshift_image_tag is defined + - name: Determine version to configure if already installed + set_fact: + openshift_version: "{{ openshift.common.version }}" + when: openshift.common.is_containerized | bool and openshift.common.version is defined + - debug: var=openshift_version + - name: Determine if master certificates need to be generated hosts: oo_first_master:oo_masters_to_config tasks: @@ -337,8 +360,50 @@ with_items: openshift_master_named_certificates when: named_certs_specified | bool -- name: Configure master instances - hosts: oo_masters_to_config +- name: Configure first master instances + hosts: oo_first_master + any_errors_fatal: true + serial: 1 + vars: + sync_tmpdir: "{{ hostvars.localhost.g_master_mktemp.stdout }}" + 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 }}" + openshift_master_session_encryption_secrets: "{{ hostvars[groups.oo_first_master.0].openshift.master.session_encryption_secrets }}" + openshift_docker_hosted_registry_network: "{{ hostvars[groups.oo_first_master.0].openshift.common.portal_net }}" + openshift_no_proxy_internal_hostnames: "{{ hostvars | oo_select_keys(groups['oo_nodes_to_config'] + | union(groups['oo_masters_to_config']) + | union(groups['oo_etcd_to_config'] | default([]))) + | oo_collect('openshift.common.hostname') | default([]) | join (',') + }}" + openshift_version: "{{ g_openshift_version_requested }}" + when: "{{ (openshift_http_proxy is defined or openshift_https_proxy is defined) and + openshift_generate_no_proxy_hosts | default(True) | bool }}" + pre_tasks: + - name: Ensure certificate directory exists + file: + path: "{{ openshift.common.config_base }}/master" + state: directory + when: master_certs_missing | bool and 'oo_first_master' not in group_names + - name: Unarchive the tarball on the master + unarchive: + src: "{{ sync_tmpdir }}/{{ master_cert_subdir }}.tgz" + dest: "{{ master_cert_config_dir }}" + when: master_certs_missing | bool and 'oo_first_master' not in group_names + - debug: var=openshift_version + roles: + - openshift_master + - role: nickhammond.logrotate + - role: nuage_master + when: openshift.common.use_nuage | bool + post_tasks: + - name: Create group for deployment type + group_by: key=oo_masters_deployment_type_{{ openshift.common.deployment_type }} + changed_when: False + +# TODO: This is a copy paste of the oo_first_master, how do we reconcile the code but change openshift_version? +- name: Configure remaining master instances + hosts: oo_masters_to_config[1:] any_errors_fatal: true serial: 1 vars: @@ -353,7 +418,8 @@ | 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 + openshift_version: "{{ g_openshift_version_requested }}" + when: "{{ (openshift_http_proxy is defined or openshift_https_proxy is defined) and openshift_generate_no_proxy_hosts | default(True) | bool }}" pre_tasks: - name: Ensure certificate directory exists -- cgit v1.2.3 From 0c7433838c8c6409b8de907fcc946fc73fe90527 Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Tue, 24 May 2016 09:46:33 -0300 Subject: Work towards determining openshift_version when unspecified. openshift_docker role was largely useless now, but also almost did what we needed. (deps ordering still needs to be changed) Remove defaulting of openshift_version. --- playbooks/common/openshift-master/config.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'playbooks/common') diff --git a/playbooks/common/openshift-master/config.yml b/playbooks/common/openshift-master/config.yml index 17afbb48c..380875a30 100644 --- a/playbooks/common/openshift-master/config.yml +++ b/playbooks/common/openshift-master/config.yml @@ -175,8 +175,8 @@ when: openshift.common.is_containerized | bool and openshift_image_tag is defined - name: Determine version to configure if already installed set_fact: - openshift_version: "{{ openshift.common.version }}" - when: openshift.common.is_containerized | bool and openshift.common.version is defined + openshift_version: "{{ openshift.common.version_requested }}" + when: openshift.common.is_containerized | bool and openshift.common.version_requested is defined - debug: var=openshift_version - name: Determine if master certificates need to be generated @@ -376,7 +376,7 @@ | union(groups['oo_etcd_to_config'] | default([]))) | oo_collect('openshift.common.hostname') | default([]) | join (',') }}" - openshift_version: "{{ g_openshift_version_requested }}" + #openshift_version: "{{ g_openshift_version_requested }}" when: "{{ (openshift_http_proxy is defined or openshift_https_proxy is defined) and openshift_generate_no_proxy_hosts | default(True) | bool }}" pre_tasks: -- cgit v1.2.3 From 436c287335c3b578aaa2c1c8835583feaee2a3cf Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Tue, 24 May 2016 11:13:33 -0300 Subject: Stop downgrading Docker because we don't know what version to install yet. --- playbooks/common/openshift-master/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'playbooks/common') diff --git a/playbooks/common/openshift-master/config.yml b/playbooks/common/openshift-master/config.yml index 380875a30..206e92c16 100644 --- a/playbooks/common/openshift-master/config.yml +++ b/playbooks/common/openshift-master/config.yml @@ -376,7 +376,7 @@ | union(groups['oo_etcd_to_config'] | default([]))) | oo_collect('openshift.common.hostname') | default([]) | join (',') }}" - #openshift_version: "{{ g_openshift_version_requested }}" + openshift_version: "{{ g_openshift_version_requested }}" when: "{{ (openshift_http_proxy is defined or openshift_https_proxy is defined) and openshift_generate_no_proxy_hosts | default(True) | bool }}" pre_tasks: -- cgit v1.2.3 From 5c833d9f29e292d11c0cbf08786e9015f133ce17 Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Tue, 24 May 2016 11:56:11 -0300 Subject: Complete installation of first master containerized. --- playbooks/common/openshift-master/config.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'playbooks/common') diff --git a/playbooks/common/openshift-master/config.yml b/playbooks/common/openshift-master/config.yml index 206e92c16..9842e3917 100644 --- a/playbooks/common/openshift-master/config.yml +++ b/playbooks/common/openshift-master/config.yml @@ -360,7 +360,7 @@ with_items: openshift_master_named_certificates when: named_certs_specified | bool -- name: Configure first master instances +- name: Configure first master instance hosts: oo_first_master any_errors_fatal: true serial: 1 @@ -400,6 +400,7 @@ - name: Create group for deployment type group_by: key=oo_masters_deployment_type_{{ openshift.common.deployment_type }} changed_when: False + - fail: # TODO: This is a copy paste of the oo_first_master, how do we reconcile the code but change openshift_version? - name: Configure remaining master instances -- cgit v1.2.3 From 717012aa4d5df01e5859ce44705abfbf34be8047 Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Wed, 25 May 2016 09:20:15 -0300 Subject: Hookup node configuration. --- playbooks/common/openshift-master/config.yml | 9 ++++----- playbooks/common/openshift-node/config.yml | 8 ++++++-- 2 files changed, 10 insertions(+), 7 deletions(-) (limited to 'playbooks/common') diff --git a/playbooks/common/openshift-master/config.yml b/playbooks/common/openshift-master/config.yml index 9842e3917..fb35a9d2f 100644 --- a/playbooks/common/openshift-master/config.yml +++ b/playbooks/common/openshift-master/config.yml @@ -175,8 +175,8 @@ when: openshift.common.is_containerized | bool and openshift_image_tag is defined - name: Determine version to configure if already installed set_fact: - openshift_version: "{{ openshift.common.version_requested }}" - when: openshift.common.is_containerized | bool and openshift.common.version_requested is defined + openshift_version: "{{ openshift.common.version }}" + when: openshift.common.is_containerized | bool and openshift.common.version is defined - debug: var=openshift_version - name: Determine if master certificates need to be generated @@ -366,6 +366,7 @@ serial: 1 vars: sync_tmpdir: "{{ hostvars.localhost.g_master_mktemp.stdout }}" + openshift_version: "{{ g_openshift_version_requested }}" 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 }}" @@ -376,7 +377,6 @@ | union(groups['oo_etcd_to_config'] | default([]))) | oo_collect('openshift.common.hostname') | default([]) | join (',') }}" - openshift_version: "{{ g_openshift_version_requested }}" when: "{{ (openshift_http_proxy is defined or openshift_https_proxy is defined) and openshift_generate_no_proxy_hosts | default(True) | bool }}" pre_tasks: @@ -400,7 +400,6 @@ - name: Create group for deployment type group_by: key=oo_masters_deployment_type_{{ openshift.common.deployment_type }} changed_when: False - - fail: # TODO: This is a copy paste of the oo_first_master, how do we reconcile the code but change openshift_version? - name: Configure remaining master instances @@ -409,6 +408,7 @@ serial: 1 vars: sync_tmpdir: "{{ hostvars.localhost.g_master_mktemp.stdout }}" + openshift_version: "{{ oo_first_master.openshift.common.version.split('-')[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 }}" @@ -419,7 +419,6 @@ | union(groups['oo_etcd_to_config'] | default([]))) | oo_collect('openshift.common.hostname') | default([]) | join (',') }}" - openshift_version: "{{ g_openshift_version_requested }}" when: "{{ (openshift_http_proxy is defined or openshift_https_proxy is defined) and openshift_generate_no_proxy_hosts | default(True) | bool }}" pre_tasks: diff --git a/playbooks/common/openshift-node/config.yml b/playbooks/common/openshift-node/config.yml index b3491ef8d..9809ee629 100644 --- a/playbooks/common/openshift-node/config.yml +++ b/playbooks/common/openshift-node/config.yml @@ -113,6 +113,7 @@ hosts: oo_containerized_master_nodes serial: 1 vars: + openshift_version: "{{ hostvars[groups.oo_first_master.0].openshift.common.version }}" openshift_node_master_api_url: "{{ hostvars[groups.oo_first_master.0].openshift.master.api_url }}" openshift_node_first_master_ip: "{{ hostvars[groups.oo_first_master.0].openshift.common.ip }}" openshift_docker_hosted_registry_network: "{{ hostvars[groups.oo_first_master.0].openshift.common.portal_net }}" @@ -121,14 +122,17 @@ | 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 }}" + pre_tasks: + - debug: var=hostvars[groups.oo_first_master.0].openshift.common.version roles: - openshift_node - name: Configure node instances hosts: oo_nodes_to_config:!oo_containerized_master_nodes vars: + openshift_version: "{{ hostvars[groups.oo_first_master.0].openshift.common.version }}" openshift_node_master_api_url: "{{ hostvars[groups.oo_first_master.0].openshift.master.api_url }}" openshift_node_first_master_ip: "{{ hostvars[groups.oo_first_master.0].openshift.common.ip }}" openshift_docker_hosted_registry_network: "{{ hostvars[groups.oo_first_master.0].openshift.common.portal_net }}" @@ -137,7 +141,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: - openshift_node -- cgit v1.2.3 From 58f920e854180cd9a8754fee82712fa8dd7b1f34 Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Wed, 25 May 2016 14:54:59 -0300 Subject: Preserve node versions on re-run. --- playbooks/common/openshift-master/config.yml | 2 +- playbooks/common/openshift-node/config.yml | 20 ++++++++++++++++---- 2 files changed, 17 insertions(+), 5 deletions(-) (limited to 'playbooks/common') diff --git a/playbooks/common/openshift-master/config.yml b/playbooks/common/openshift-master/config.yml index fb35a9d2f..97a7db9a1 100644 --- a/playbooks/common/openshift-master/config.yml +++ b/playbooks/common/openshift-master/config.yml @@ -158,6 +158,7 @@ # Must be run before generating master certs which involved openshift_cli role and needs # to pull down the correct docker container: +# TODO: Handle rpm installs here - name: Determine openshift_version to install on first master hosts: oo_first_master any_errors_fatal: true @@ -366,7 +367,6 @@ serial: 1 vars: sync_tmpdir: "{{ hostvars.localhost.g_master_mktemp.stdout }}" - openshift_version: "{{ g_openshift_version_requested }}" 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 }}" diff --git a/playbooks/common/openshift-node/config.yml b/playbooks/common/openshift-node/config.yml index 9809ee629..5e92b5cbd 100644 --- a/playbooks/common/openshift-node/config.yml +++ b/playbooks/common/openshift-node/config.yml @@ -109,11 +109,26 @@ 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 vars: - openshift_version: "{{ hostvars[groups.oo_first_master.0].openshift.common.version }}" openshift_node_master_api_url: "{{ hostvars[groups.oo_first_master.0].openshift.master.api_url }}" openshift_node_first_master_ip: "{{ hostvars[groups.oo_first_master.0].openshift.common.ip }}" openshift_docker_hosted_registry_network: "{{ hostvars[groups.oo_first_master.0].openshift.common.portal_net }}" @@ -124,15 +139,12 @@ }}" when: "{{ (openshift_http_proxy is defined or openshift_https_proxy is defined) and openshift_generate_no_proxy_hosts | default(True) | bool }}" - pre_tasks: - - debug: var=hostvars[groups.oo_first_master.0].openshift.common.version roles: - openshift_node - name: Configure node instances hosts: oo_nodes_to_config:!oo_containerized_master_nodes vars: - openshift_version: "{{ hostvars[groups.oo_first_master.0].openshift.common.version }}" openshift_node_master_api_url: "{{ hostvars[groups.oo_first_master.0].openshift.master.api_url }}" openshift_node_first_master_ip: "{{ hostvars[groups.oo_first_master.0].openshift.common.ip }}" openshift_docker_hosted_registry_network: "{{ hostvars[groups.oo_first_master.0].openshift.common.portal_net }}" -- cgit v1.2.3 From 14b23a8b14636407143375cbac71b090663cee77 Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Thu, 26 May 2016 14:30:37 -0300 Subject: Get rpm installations functional again. --- .../common/openshift-cluster/upgrades/v3_1_to_v3_2/pre.yml | 2 ++ playbooks/common/openshift-master/config.yml | 14 ++++++++++---- 2 files changed, 12 insertions(+), 4 deletions(-) (limited to 'playbooks/common') 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 97a7db9a1..063d86f60 100644 --- a/playbooks/common/openshift-master/config.yml +++ b/playbooks/common/openshift-master/config.yml @@ -158,7 +158,6 @@ # Must be run before generating master certs which involved openshift_cli role and needs # to pull down the correct docker container: -# TODO: Handle rpm installs here - name: Determine openshift_version to install on first master hosts: oo_first_master any_errors_fatal: true @@ -170,14 +169,21 @@ set_fact: openshift_version: "{{ openshift_release }}" when: openshift.common.is_containerized | bool and openshift_release is defined - - name: Determine version to configure if containerized and image tag specified +# TODO: what should we do for rpm installs and openshift_release here? + - name: Determine container version to configure when openshift_image_tag specified set_fact: openshift_version: "{{ openshift_image_tag.split('v',1)[1] }}" when: openshift.common.is_containerized | bool and openshift_image_tag is defined - - name: Determine version to configure if already installed + - 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 openshift.common.is_containerized | bool and openshift_pkg_version is defined + - name: Use openshift.common.version fact as version to configure if already installed set_fact: openshift_version: "{{ openshift.common.version }}" - when: openshift.common.is_containerized | bool and openshift.common.version is defined + when: openshift.common.version is defined - debug: var=openshift_version - name: Determine if master certificates need to be generated -- cgit v1.2.3 From 3f7ac81838d0cef4ea95505abf82be7e114ae415 Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Mon, 30 May 2016 09:20:28 -0300 Subject: Protect installed version on subsequent masters. --- playbooks/common/openshift-master/config.yml | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) (limited to 'playbooks/common') diff --git a/playbooks/common/openshift-master/config.yml b/playbooks/common/openshift-master/config.yml index 063d86f60..1812ccd1f 100644 --- a/playbooks/common/openshift-master/config.yml +++ b/playbooks/common/openshift-master/config.yml @@ -158,10 +158,12 @@ # Must be run before generating master certs which involved openshift_cli role and needs # to pull down the correct docker container: -- name: Determine openshift_version to install on first master +- name: Determine openshift_version to configure on first master hosts: oo_first_master any_errors_fatal: true - tasks: + # We do initial seeding of openshift_version if possible with these tasks. The openshift_docker role + # will make absolutely sure it's set to a specific version after this. + pre_tasks: - debug: var=openshift.common - debug: var=openshift_image_tag - debug: var=openshift_release @@ -185,6 +187,24 @@ openshift_version: "{{ openshift.common.version }}" when: openshift.common.version is defined - debug: var=openshift_version + roles: + - openshift_docker + +# Re-use pre-existing version fact if present, if not use the first master's +# openshift_version calculated above. +- name: Determine openshift_version to configure on remaining masters + hosts: oo_masters_to_config[1:] + any_errors_fatal: true + tasks: + - set_fact: + openshift_version: "{{ hostvars[groups.oo_first_master.0].openshift_version }}" + when: openshift.common.version is not defined + - set_fact: + openshift_version: "{{ openshift.common.version }}" + when: openshift.common.version is defined + - debug: var=openshift_version + post_tasks: + - fail: - name: Determine if master certificates need to be generated hosts: oo_first_master:oo_masters_to_config -- cgit v1.2.3 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. --- playbooks/common/openshift-cluster/config.yml | 2 + .../initialize_openshift_version.yml | 32 ++++++++ playbooks/common/openshift-master/config.yml | 86 ++-------------------- 3 files changed, 42 insertions(+), 78 deletions(-) create mode 100644 playbooks/common/openshift-cluster/initialize_openshift_version.yml (limited to 'playbooks/common') 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 + diff --git a/playbooks/common/openshift-master/config.yml b/playbooks/common/openshift-master/config.yml index 1812ccd1f..c39af9c40 100644 --- a/playbooks/common/openshift-master/config.yml +++ b/playbooks/common/openshift-master/config.yml @@ -167,45 +167,10 @@ - debug: var=openshift.common - debug: var=openshift_image_tag - debug: var=openshift_release - - name: Determine version to configure if containerized and release specified - set_fact: - openshift_version: "{{ openshift_release }}" - when: openshift.common.is_containerized | bool and openshift_release is defined -# TODO: what should we do for rpm installs and openshift_release here? - - name: Determine container version to configure when openshift_image_tag specified - set_fact: - openshift_version: "{{ openshift_image_tag.split('v',1)[1] }}" - when: openshift.common.is_containerized | bool and openshift_image_tag is defined - - 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 openshift.common.is_containerized | bool and openshift_pkg_version is 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 - debug: var=openshift_version roles: - openshift_docker -# Re-use pre-existing version fact if present, if not use the first master's -# openshift_version calculated above. -- name: Determine openshift_version to configure on remaining masters - hosts: oo_masters_to_config[1:] - any_errors_fatal: true - tasks: - - set_fact: - openshift_version: "{{ hostvars[groups.oo_first_master.0].openshift_version }}" - when: openshift.common.version is not defined - - set_fact: - openshift_version: "{{ openshift.common.version }}" - when: openshift.common.version is defined - - debug: var=openshift_version - post_tasks: - - fail: - - name: Determine if master certificates need to be generated hosts: oo_first_master:oo_masters_to_config tasks: @@ -387,54 +352,19 @@ with_items: openshift_master_named_certificates when: named_certs_specified | bool -- name: Configure first master instance - hosts: oo_first_master +- name: Configure masters + hosts: oo_masters_to_config any_errors_fatal: true serial: 1 vars: sync_tmpdir: "{{ hostvars.localhost.g_master_mktemp.stdout }}" - 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 }}" - openshift_master_session_encryption_secrets: "{{ hostvars[groups.oo_first_master.0].openshift.master.session_encryption_secrets }}" - openshift_docker_hosted_registry_network: "{{ hostvars[groups.oo_first_master.0].openshift.common.portal_net }}" - openshift_no_proxy_internal_hostnames: "{{ hostvars | oo_select_keys(groups['oo_nodes_to_config'] - | union(groups['oo_masters_to_config']) - | 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 - openshift_generate_no_proxy_hosts | default(True) | bool }}" - pre_tasks: - - name: Ensure certificate directory exists - file: - path: "{{ openshift.common.config_base }}/master" - state: directory - when: master_certs_missing | bool and 'oo_first_master' not in group_names - - name: Unarchive the tarball on the master - unarchive: - src: "{{ sync_tmpdir }}/{{ master_cert_subdir }}.tgz" - dest: "{{ master_cert_config_dir }}" - when: master_certs_missing | bool and 'oo_first_master' not in group_names - - debug: var=openshift_version - roles: - - openshift_master - - role: nickhammond.logrotate - - role: nuage_master - when: openshift.common.use_nuage | bool - post_tasks: - - name: Create group for deployment type - group_by: key=oo_masters_deployment_type_{{ openshift.common.deployment_type }} - changed_when: False -# TODO: This is a copy paste of the oo_first_master, how do we reconcile the code but change openshift_version? -- name: Configure remaining master instances - hosts: oo_masters_to_config[1:] - any_errors_fatal: true - serial: 1 - vars: - sync_tmpdir: "{{ hostvars.localhost.g_master_mktemp.stdout }}" - openshift_version: "{{ oo_first_master.openshift.common.version.split('-')[0] }}" + # 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 }}" -- cgit v1.2.3 From efb153693104976e86a91ebf6bf236448be5a84d Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Tue, 31 May 2016 10:26:53 -0300 Subject: Drop unnecessary node playbook version calculation. --- playbooks/common/openshift-node/config.yml | 16 ---------------- 1 file changed, 16 deletions(-) (limited to 'playbooks/common') diff --git a/playbooks/common/openshift-node/config.yml b/playbooks/common/openshift-node/config.yml index 5e92b5cbd..bffac0e56 100644 --- a/playbooks/common/openshift-node/config.yml +++ b/playbooks/common/openshift-node/config.yml @@ -109,22 +109,6 @@ 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 -- 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') 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 ---- playbooks/common/openshift-master/config.yml | 2 +- 2 files changed, 1 insertion(+), 5 deletions(-) (limited to 'playbooks/common') 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] }}" -- cgit v1.2.3 From 9f40c71d007ec7098090a4edafc1846cc37d5dc2 Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Mon, 6 Jun 2016 12:04:10 -0300 Subject: Drop unused and broken "when" in vars section. --- playbooks/common/openshift-master/config.yml | 7 ------- 1 file changed, 7 deletions(-) (limited to 'playbooks/common') diff --git a/playbooks/common/openshift-master/config.yml b/playbooks/common/openshift-master/config.yml index 7ab046e04..5e57cdeef 100644 --- a/playbooks/common/openshift-master/config.yml +++ b/playbooks/common/openshift-master/config.yml @@ -316,13 +316,6 @@ serial: 1 vars: sync_tmpdir: "{{ hostvars.localhost.g_master_mktemp.stdout }}" - - # 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] }}" - 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 }}" -- cgit v1.2.3 From effc29ad8a0822b3981ff833fe66cc70f4e1e68c Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Tue, 7 Jun 2016 10:53:00 -0300 Subject: Verify openshift_release is correct or absent in inventory before upgrade. --- .../upgrades/v3_1_to_v3_2/pre.yml | 24 ++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) (limited to 'playbooks/common') 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 84b7c817b..e4be39f91 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 @@ -22,10 +22,10 @@ ############################################################################### # Pre-upgrade checks ############################################################################### -- name: Verify upgrade can proceed +- name: Verify upgrade can proceed on first master hosts: oo_first_master vars: - target_version: "{{ '1.2' if deployment_type == 'origin' else '3.1.1.900' }}" + target_version: "{{ '1.2' if deployment_type == 'origin' else '3.2' }}" g_pacemaker_upgrade_url_segment: "{{ 'org/latest' if deployment_type =='origin' else '.com/enterprise/3.1' }}" gather_facts: no tasks: @@ -41,6 +41,11 @@ https://docs.openshift.{{ g_pacemaker_upgrade_url_segment }}/install_config/upgrading/pacemaker_to_native_ha.html when: openshift.master.cluster_method is defined and openshift.master.cluster_method == 'pacemaker' + # Error out in situations where the user has older versions specified in their + # inventory in any of the openshift_release, openshift_image_tag, and + # openshift_pkg_version variables. These must be removed or updated to proceed + # with upgrade. + # TODO: Should we block if you're *over* the next major release version as well? - fail: msg: > openshift_pkg_version is {{ openshift_pkg_version }} which is not a @@ -53,11 +58,22 @@ valid version for a {{ target_version }} upgrade when: openshift_image_tag is defined and openshift_image_tag.split('v',1).1 | version_compare(target_version ,'<') -- name: Verify upgrade can proceed + - fail: + msg: > + openshift_release is {{ openshift_release }} which is not a + valid release for a {{ target_version }} upgrade + when: openshift_release is defined and not openshift_release | version_compare(target_version ,'=') + +- include: ../../../../common/openshift-cluster/initialize_openshift_version.yml + vars: + openshift_release: "3.2" + +- name: Verify upgrade can proceed on masters hosts: oo_masters_to_config roles: - openshift_facts tasks: + - fail: - openshift_facts: role: master local_facts: @@ -84,7 +100,7 @@ enabled: yes when: openshift.master.ha is defined and openshift.master.ha | bool and openshift.common.is_containerized | bool -- name: Verify upgrade can proceed +- name: Verify upgrade can proceed on nodes hosts: oo_nodes_to_config roles: - openshift_facts -- 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 +- playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/pre.yml | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'playbooks/common') 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 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 e4be39f91..f9ca26e34 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 @@ -66,7 +66,9 @@ - include: ../../../../common/openshift-cluster/initialize_openshift_version.yml vars: - openshift_release: "3.2" + # Force the openshift_version role to 3.2, it will convert this to a more specific variable and + # make sure the openshift_image_tag and openshift_pkg_version are all set appropriately. + openshift_version: "3.2" - name: Verify upgrade can proceed on masters hosts: oo_masters_to_config -- 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 +++++++----- .../common/openshift-cluster/upgrades/v3_1_to_v3_2/pre.yml | 8 +++++--- 2 files changed, 12 insertions(+), 8 deletions(-) (limited to 'playbooks/common') 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 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 f9ca26e34..8596443c0 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 @@ -66,9 +66,11 @@ - include: ../../../../common/openshift-cluster/initialize_openshift_version.yml vars: - # Force the openshift_version role to 3.2, it will convert this to a more specific variable and - # make sure the openshift_image_tag and openshift_pkg_version are all set appropriately. - openshift_version: "3.2" + # Request openshift_release 3.2 and let the openshift_version role handle converting this + # to a more specific version, respecting openshift_image_tag and openshift_pkg_version if + # defined, and overriding the normal behavior of protecting the installed version + openshift_release: "3.2" + openshift_protect_installed_version: False - name: Verify upgrade can proceed on masters hosts: oo_masters_to_config -- cgit v1.2.3 From 096cf64128ebcb1249044a1cb28b1b06154766ae Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Thu, 9 Jun 2016 08:08:49 -0300 Subject: Begin major simplification of 3.2 upgrade. --- .../upgrades/v3_1_to_v3_2/pre.yml | 97 ++++++---------------- 1 file changed, 24 insertions(+), 73 deletions(-) (limited to 'playbooks/common') 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 8596443c0..03b4bd751 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 @@ -77,7 +77,6 @@ roles: - openshift_facts tasks: - - fail: - openshift_facts: role: master local_facts: @@ -116,22 +115,20 @@ enabled: yes when: openshift.common.is_containerized | bool -- name: Verify upgrade can proceed +- name: Verify upgrade can proceed on masters and nodes hosts: oo_masters_to_config:oo_nodes_to_config vars: - target_version: "{{ '1.2' if deployment_type == 'origin' else '3.1.1.900' }}" + target_version: "{{ '1.2' if deployment_type == 'origin' else '3.2' }}" openshift_docker_hosted_registry_network: "{{ hostvars[groups.oo_first_master.0].openshift.common.portal_net }}" - upgrading: True - handlers: - - include: ../../../../../roles/openshift_master/handlers/main.yml - - include: ../../../../../roles/openshift_node/handlers/main.yml - roles: - # We want the cli role to evaluate so that the containerized oc/oadm wrappers - # are modified to use the correct image tag. However, this can trigger a - # docker restart if new configuration is laid down which would immediately - # pull the latest image and defeat the purpose of these tasks. - - { role: openshift_cli } pre_tasks: + - fail: + msg: Verify OpenShift is already installed + when: openshift.common.version is not defined + + - fail: + msg: Verify the correct version was found + when: verify_upgrade_version is defined and openshift_version != verify_upgrade_version + - name: Clean package cache command: "{{ ansible_pkg_mgr }} clean all" when: not openshift.common.is_atomic | bool @@ -140,60 +137,17 @@ g_new_service_name: "{{ 'origin' if deployment_type =='origin' else 'atomic-openshift' }}" when: not openshift.common.is_containerized | bool - - name: Determine available versions - script: ../files/rpm_versions.sh {{ g_new_service_name }} - 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 - - - name: Determine available versions - script: ../files/openshift_container_versions.sh {{ openshift.common.service_type }} - register: g_containerized_versions_result - when: openshift.common.is_containerized | bool - - - set_fact: - g_aos_versions: "{{ g_containerized_versions_result.stdout | from_yaml }}" + - name: Verify containers are available for upgrade + command: > + docker pull {{ openshift.common.cli_image }}:v{{ openshift_version }} when: openshift.common.is_containerized | bool - - set_fact: - g_new_version: "{{ g_aos_versions.curr_version.split('-', 1).0 if g_aos_versions.avail_version is none else g_aos_versions.avail_version.split('-', 1).0 }}" - when: openshift_pkg_version is not defined - - - set_fact: - g_new_version: "{{ openshift_pkg_version | replace('-','') }}" - when: openshift_pkg_version is defined - - - set_fact: - g_new_version: "{{ openshift_image_tag | replace('v','') }}" - when: openshift_image_tag is defined - - - fail: - msg: Verifying the correct version was found - when: g_aos_versions.curr_version == "" - - - fail: - msg: Verifying the correct version was found - when: verify_upgrade_version is defined and g_new_version != verify_upgrade_version - - - include_vars: ../../../../../roles/openshift_master/vars/main.yml - when: inventory_hostname in groups.oo_masters_to_config - - - name: Update systemd units - include: ../../../../../roles/openshift_master/tasks/systemd_units.yml openshift_version=v{{ g_new_version }} - when: inventory_hostname in groups.oo_masters_to_config - - - include_vars: ../../../../../roles/openshift_node/vars/main.yml - when: inventory_hostname in groups.oo_nodes_to_config - - - name: Update systemd units - include: ../../../../../roles/openshift_node/tasks/systemd_units.yml openshift_version=v{{ g_new_version }} - when: inventory_hostname in groups.oo_nodes_to_config + - name: Verify RPMs are available for upgrade + command: > + yum list available -e 0 -q "{{ g_new_service_name }}" 2>&1 | tail -n +2 | grep -v 'el7ose' | awk '{ print $2 }' | sort -r | tr '\n' ' ') + when: not openshift.common.is_containerized | bool + # TODO: Are these two grep checks necessary anymore? # Note: the version number is hardcoded here in hopes of catching potential # bugs in how g_aos_versions.curr_version is set - name: Verifying the correct version is installed for upgrade @@ -208,19 +162,15 @@ with_items: - /etc/systemd/system/openvswitch.service - /etc/systemd/system/{{ openshift.common.service_type }}*.service - when: openshift.common.is_containerized | bool - - - fail: - msg: This playbook requires Origin 1.1 or later - when: deployment_type == 'origin' and g_aos_versions.curr_version | version_compare('1.1','<') + when: openshift.common.is_containerized | bool and verify_upgrade_version is defined - fail: - msg: This playbook requires Atomic Enterprise Platform/OpenShift Enterprise 3.1 or later - when: deployment_type == 'atomic-openshift' and g_aos_versions.curr_version | version_compare('3.1','<') + msg: This upgrade playbook must be run on Origin 1.1 or later + when: deployment_type == 'origin' and openshift.common.version | version_compare('1.1','<') - fail: - msg: Upgrade packages not found - when: openshift_image_tag is not defined and (g_aos_versions.avail_version | default(g_aos_versions.curr_version, true) | version_compare(target_version, '<')) + msg: This upgrade playbook must be run on OpenShift Enterprise 3.1 or later + when: deployment_type == 'atomic-openshift' and openshift.common.version | version_compare('3.1','<') - name: Determine available Docker script: ../files/rpm_versions.sh docker @@ -240,6 +190,7 @@ g_docker_version: "{{ g_atomic_docker_version_result.stdout | from_yaml }}" when: openshift.common.is_atomic | bool + # TODO: Update to 1.10 once branch merges - fail: msg: This playbook requires access to Docker 1.9 or later when: g_docker_version.avail_version | default(g_docker_version.curr_version, true) | version_compare('1.9','<') -- cgit v1.2.3 From bcf414e8b559d35909f26420d9e7dec3cd0a1897 Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Thu, 9 Jun 2016 12:48:40 -0300 Subject: Fix missing openshift.common.version fact on containerized nodes. --- playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/pre.yml | 2 ++ 1 file changed, 2 insertions(+) (limited to 'playbooks/common') 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 42641f2eb..770ccaa78 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 @@ -107,7 +107,9 @@ hosts: oo_nodes_to_config roles: - openshift_facts + - openshift_docker_facts tasks: + - debug: var=openshift.docker.openshift_version - name: Ensure Node is running service: name: "{{ openshift.common.service_type }}-node" -- cgit v1.2.3 From 755a48c4ebf1061ce19892e5378fba769027bfc1 Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Fri, 10 Jun 2016 10:21:19 -0300 Subject: Fix version unset bug, and set common ver fact on containerized nodes. --- playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/pre.yml | 1 - 1 file changed, 1 deletion(-) (limited to 'playbooks/common') 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 770ccaa78..1a3b557e7 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 @@ -109,7 +109,6 @@ - openshift_facts - openshift_docker_facts tasks: - - debug: var=openshift.docker.openshift_version - name: Ensure Node is running service: name: "{{ openshift.common.service_type }}-node" -- cgit v1.2.3 From 83ec4f5469b8a64d834bb3f57447c34433302fe3 Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Fri, 10 Jun 2016 11:46:54 -0300 Subject: Temporary fix for upgrading issue. --- playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/pre.yml | 1 + 1 file changed, 1 insertion(+) (limited to 'playbooks/common') 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 1a3b557e7..c2847e163 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 @@ -71,6 +71,7 @@ # defined, and overriding the normal behavior of protecting the installed version openshift_release: "3.2" openshift_protect_installed_version: False + upgrading: true - name: Verify master processes hosts: oo_masters_to_config -- cgit v1.2.3 From af2cc5587132427faae21785599280b1f05e6cda Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Mon, 13 Jun 2016 15:15:50 -0300 Subject: Restore 3.2 RPM version check before upgrading. --- .../openshift-cluster/upgrades/v3_1_to_v3_2/pre.yml | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'playbooks/common') 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 c2847e163..9cba1b40b 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 @@ -144,11 +144,26 @@ docker pull {{ openshift.common.cli_image }}:v{{ openshift_version }} when: openshift.common.is_containerized | bool - - name: Verify RPMs are available for upgrade + - set_fact: + repoquery_cmd: "{{ 'dnf repoquery --latest-limit 1 -d 0' if ansible_pkg_mgr == 'dnf' else 'repoquery' }}" + when: not openshift.common.is_containerized | bool + + - name: Check latest available OpenShift RPM version command: > - yum list available -e 0 -q "{{ g_new_service_name }}" 2>&1 | tail -n +2 | grep -v 'el7ose' | awk '{ print $2 }' | sort -r | tr '\n' ' ') + {{ repoquery_cmd }} --qf '%{version}' "{{ openshift.common.service_type }}" + failed_when: false + changed_when: false + register: avail_openshift_version when: not openshift.common.is_containerized | bool + - debug: var=avail_openshift_version + + - name: Verify OpenShift 3.2 RPMs are available for upgrade + fail: + msg: "OpenShift {{ avail_openshift_version.stdout }} is available, but 3.2 or greater is required" + when: not openshift.common.is_containerized | bool and not avail_openshift_version | skipped and avail_openshift_version.stdout | default('0.0', True) | version_compare('3.2', '<') + + # TODO: Are these two grep checks necessary anymore? # Note: the version number is hardcoded here in hopes of catching potential # bugs in how g_aos_versions.curr_version is set -- cgit v1.2.3 From b1cabe9584c17fb38f4243054c4a40a5e5522b65 Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Mon, 13 Jun 2016 15:22:39 -0300 Subject: Don't be specific about rpm version to upgrade to for now. --- .../common/openshift-cluster/upgrades/v3_1_to_v3_2/rpm_upgrade.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'playbooks/common') diff --git a/playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/rpm_upgrade.yml b/playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/rpm_upgrade.yml index 5c96ad094..ea27a40d1 100644 --- a/playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/rpm_upgrade.yml +++ b/playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/rpm_upgrade.yml @@ -1,5 +1,6 @@ +# TODO: Use a specific version here once we're setting openshift_pkg_version reliably in the openshift_version module. - name: Upgrade packages - command: "{{ ansible_pkg_mgr}} update -y {{ openshift.common.service_type }}-{{ component }}-{{ g_new_version }}" + command: "{{ ansible_pkg_mgr}} update -y {{ openshift.common.service_type }}-{{ component }}" - name: Ensure python-yaml present for config upgrade action: "{{ ansible_pkg_mgr }} name=PyYAML state=present" -- cgit v1.2.3 From 04643670db5709358fe55916705a9ce15ff0bb1e Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Mon, 13 Jun 2016 15:32:10 -0300 Subject: Remove the use of the upgrading variable. --- playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/pre.yml | 1 - playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/upgrade.yml | 1 - 2 files changed, 2 deletions(-) (limited to 'playbooks/common') 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 9cba1b40b..d0960da76 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 @@ -71,7 +71,6 @@ # defined, and overriding the normal behavior of protecting the installed version openshift_release: "3.2" openshift_protect_installed_version: False - upgrading: true - name: Verify master processes hosts: oo_masters_to_config diff --git a/playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/upgrade.yml b/playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/upgrade.yml index c93bf2a17..7b5b9e8d7 100644 --- a/playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/upgrade.yml +++ b/playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/upgrade.yml @@ -132,7 +132,6 @@ origin_reconcile_bindings: "{{ deployment_type == 'origin' and g_new_version | version_compare('1.0.6', '>') }}" ent_reconcile_bindings: true openshift_docker_hosted_registry_network: "{{ hostvars[groups.oo_first_master.0].openshift.common.portal_net }}" - upgrading: True tasks: - name: Verifying the correct commandline tools are available shell: grep {{ verify_upgrade_version }} {{ openshift.common.admin_binary}} -- cgit v1.2.3 From a836a35b63ff1476eca5a8545a6c11ab389026d0 Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Tue, 14 Jun 2016 09:06:39 -0300 Subject: Always populate openshift_image_tag and openshift_pkg_version. Allows the use of arbitrary tags, precise control over containers and rpms, and likely mixed environments. --- .../upgrades/files/openshift_container_versions.sh | 22 ---------------------- .../upgrades/v3_1_to_v3_2/pre.yml | 2 +- 2 files changed, 1 insertion(+), 23 deletions(-) delete mode 100644 playbooks/common/openshift-cluster/upgrades/files/openshift_container_versions.sh (limited to 'playbooks/common') diff --git a/playbooks/common/openshift-cluster/upgrades/files/openshift_container_versions.sh b/playbooks/common/openshift-cluster/upgrades/files/openshift_container_versions.sh deleted file mode 100644 index 9bbeff660..000000000 --- a/playbooks/common/openshift-cluster/upgrades/files/openshift_container_versions.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash - -# Here we don't really care if this is a master, api, controller or node image. -# We just need to know the version of one of them. -unit_file=$(ls /etc/systemd/system/${1}*.service | grep -v node-dep | head -n1) - -if [ ${1} == "origin" ]; then - image_name="openshift/origin" -elif grep aep $unit_file 2>&1 > /dev/null; then - image_name="aep3/node" -elif grep openshift3 $unit_file 2>&1 > /dev/null; then - image_name="openshift3/node" -fi - -installed=$(docker run --rm --entrypoint=/bin/openshift ${image_name} version 2> /dev/null | grep openshift | awk '{ print $2 }' | cut -f1 -d"-" | tr -d 'v') - -docker pull ${image_name} 2>&1 > /dev/null -available=$(docker run --rm --entrypoint=/bin/openshift ${image_name} version 2> /dev/null | grep openshift | awk '{ print $2 }' | cut -f1 -d"-" | tr -d 'v') - -echo "---" -echo "curr_version: ${installed}" -echo "avail_version: ${available}" 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 d0960da76..a5a9a0fec 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 @@ -140,7 +140,7 @@ - name: Verify containers are available for upgrade command: > - docker pull {{ openshift.common.cli_image }}:v{{ openshift_version }} + docker pull {{ openshift.common.cli_image }}:{{ openshift_image_tag }} when: openshift.common.is_containerized | bool - set_fact: -- cgit v1.2.3 From 739ad9de2a11bb8c67d77641a86cfd39e4594542 Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Wed, 15 Jun 2016 10:56:29 -0300 Subject: Remove old upgrade playbooks. --- .../upgrades/v3_0_minor/upgrade.yml | 113 ---- .../upgrades/v3_0_to_v3_1/upgrade.yml | 645 --------------------- .../upgrades/v3_1_minor/upgrade.yml | 140 ----- 3 files changed, 898 deletions(-) delete mode 100644 playbooks/common/openshift-cluster/upgrades/v3_0_minor/upgrade.yml delete mode 100644 playbooks/common/openshift-cluster/upgrades/v3_0_to_v3_1/upgrade.yml delete mode 100644 playbooks/common/openshift-cluster/upgrades/v3_1_minor/upgrade.yml (limited to 'playbooks/common') diff --git a/playbooks/common/openshift-cluster/upgrades/v3_0_minor/upgrade.yml b/playbooks/common/openshift-cluster/upgrades/v3_0_minor/upgrade.yml deleted file mode 100644 index 5b2bf9f93..000000000 --- a/playbooks/common/openshift-cluster/upgrades/v3_0_minor/upgrade.yml +++ /dev/null @@ -1,113 +0,0 @@ ---- -- name: Evaluate groups - include: ../../evaluate_groups.yml - -- name: Re-Run cluster configuration to apply latest configuration changes - include: ../../config.yml - -- name: Upgrade masters - hosts: oo_masters_to_config - vars: - openshift_version: "{{ openshift_pkg_version | default('') }}" - tasks: - - name: Upgrade master packages - action: "{{ ansible_pkg_mgr }} name={{ openshift.common.service_type }}-master{{ openshift_version }} state=latest" - - name: Restart master services - service: name="{{ openshift.common.service_type}}-master" state=restarted - -- name: Upgrade nodes - hosts: oo_nodes_to_config - vars: - openshift_version: "{{ openshift_pkg_version | default('') }}" - tasks: - - name: Upgrade node packages - action: "{{ ansible_pkg_mgr }} name={{ openshift.common.service_type }}-node{{ openshift_version }} state=latest" - - name: Restart node services - service: name="{{ openshift.common.service_type }}-node" state=restarted - -- name: Determine new master version - hosts: oo_first_master - tasks: - - name: Determine new version - command: > - rpm -q --queryformat '%{version}' {{ openshift.common.service_type }}-master - register: _new_version - -- name: Ensure AOS 3.0.2 or Origin 1.0.6 - hosts: oo_first_master - tasks: - - fail: - msg: "This playbook requires Origin 1.0.6 or Atomic OpenShift 3.0.2 or later" - when: _new_version.stdout | version_compare('1.0.6','<') or ( _new_version.stdout | version_compare('3.0','>=' and _new_version.stdout | version_compare('3.0.2','<') ) - -- name: Update cluster policy - hosts: oo_first_master - tasks: - - name: oadm policy reconcile-cluster-roles --additive-only=true --confirm - command: > - {{ openshift.common.admin_binary}} --config={{ openshift.common.config_base }}/master/admin.kubeconfig - policy reconcile-cluster-roles --additive-only=true --confirm - -- name: Upgrade default router - hosts: oo_first_master - vars: - - router_image: "{{ openshift.master.registry_url | replace( '${component}', 'haproxy-router' ) | replace ( '${version}', 'v' + _new_version.stdout ) }}" - - oc_cmd: "{{ openshift.common.client_binary }} --config={{ openshift.common.config_base }}/master/admin.kubeconfig" - tasks: - - name: Check for default router - command: > - {{ oc_cmd }} get -n default dc/router - register: _default_router - failed_when: false - changed_when: false - - name: Check for allowHostNetwork and allowHostPorts - when: _default_router.rc == 0 - shell: > - {{ oc_cmd }} get -o yaml scc/privileged | /usr/bin/grep -e allowHostPorts -e allowHostNetwork - register: _scc - - name: Grant allowHostNetwork and allowHostPorts - when: - - _default_router.rc == 0 - - "'false' in _scc.stdout" - command: > - {{ oc_cmd }} patch scc/privileged -p '{"allowHostPorts":true,"allowHostNetwork":true}' --loglevel=9 - - name: Update deployment config to 1.0.4/3.0.1 spec - when: _default_router.rc == 0 - command: > - {{ oc_cmd }} patch dc/router -p - '{"spec":{"strategy":{"rollingParams":{"updatePercent":-10},"spec":{"serviceAccount":"router","serviceAccountName":"router"}}}}' - - name: Switch to hostNetwork=true - when: _default_router.rc == 0 - command: > - {{ oc_cmd }} patch dc/router -p '{"spec":{"template":{"spec":{"hostNetwork":true}}}}' - - name: Update router image to current version - when: _default_router.rc == 0 - command: > - {{ oc_cmd }} patch dc/router -p - '{"spec":{"template":{"spec":{"containers":[{"name":"router","image":"{{ router_image }}"}]}}}}' - -- name: Upgrade default - hosts: oo_first_master - vars: - - registry_image: "{{ openshift.master.registry_url | replace( '${component}', 'docker-registry' ) | replace ( '${version}', 'v' + _new_version.stdout ) }}" - - oc_cmd: "{{ openshift.common.client_binary }} --config={{ openshift.common.config_base }}/master/admin.kubeconfig" - tasks: - - name: Check for default registry - command: > - {{ oc_cmd }} get -n default dc/docker-registry - register: _default_registry - failed_when: false - changed_when: false - - name: Update registry image to current version - when: _default_registry.rc == 0 - command: > - {{ oc_cmd }} patch dc/docker-registry -p - '{"spec":{"template":{"spec":{"containers":[{"name":"registry","image":"{{ registry_image }}"}]}}}}' - -- name: Update image streams and templates - hosts: oo_first_master - vars: - openshift_examples_import_command: "update" - openshift_deployment_type: "{{ deployment_type }}" - roles: - - openshift_examples diff --git a/playbooks/common/openshift-cluster/upgrades/v3_0_to_v3_1/upgrade.yml b/playbooks/common/openshift-cluster/upgrades/v3_0_to_v3_1/upgrade.yml deleted file mode 100644 index 3a4c58e43..000000000 --- a/playbooks/common/openshift-cluster/upgrades/v3_0_to_v3_1/upgrade.yml +++ /dev/null @@ -1,645 +0,0 @@ ---- -############################################################################### -# Evaluate host groups and gather facts -############################################################################### -- name: Evaluate host groups - include: ../../evaluate_groups.yml - -- name: Load openshift_facts - hosts: oo_masters_to_config:oo_nodes_to_config:oo_etcd_to_config:oo_lb_to_config - roles: - - openshift_facts - -- name: Evaluate additional groups for upgrade - hosts: localhost - connection: local - become: no - tasks: - - name: Evaluate etcd_hosts_to_backup - add_host: - name: "{{ item }}" - groups: etcd_hosts_to_backup - with_items: groups.oo_etcd_to_config if groups.oo_etcd_to_config is defined and groups.oo_etcd_to_config | length > 0 else groups.oo_first_master - - -############################################################################### -# Pre-upgrade checks -############################################################################### -- name: Verify upgrade can proceed - hosts: oo_first_master - vars: - openshift_master_ha: "{{ groups.oo_masters_to_config | length > 1 }}" - target_version: "{{ '1.1' if deployment_type == 'origin' else '3.1' }}" - gather_facts: no - tasks: - # Pacemaker is currently the only supported upgrade path for multiple masters - - fail: - msg: "openshift_master_cluster_method must be set to 'pacemaker'" - when: openshift_master_ha | bool and ((openshift_master_cluster_method is not defined) or (openshift_master_cluster_method is defined and openshift_master_cluster_method != "pacemaker")) - - - fail: - msg: > - This upgrade is only supported for origin, openshift-enterprise, and online - deployment types - when: deployment_type not in ['origin','openshift-enterprise', 'online'] - - - fail: - msg: > - openshift_pkg_version is {{ openshift_pkg_version }} which is not a - valid version for a {{ target_version }} upgrade - when: openshift_pkg_version is defined and openshift_pkg_version.split('-',1).1 | version_compare(target_version ,'<') - - # If this script errors out ansible will show the default stdout/stderr - # which contains details for the user: - - script: ../files/pre-upgrade-check - - -- name: Verify upgrade targets - hosts: oo_masters_to_config:oo_nodes_to_config - vars: - target_version: "{{ '1.1' if deployment_type == 'origin' else '3.1' }}" - tasks: - - name: Clean package cache - command: "{{ ansible_pkg_mgr }} clean all" - - - set_fact: - g_new_service_name: "{{ 'origin' if deployment_type =='origin' else 'atomic-openshift' }}" - - - name: Determine available versions - script: ../files/rpm_versions.sh {{ g_new_service_name }} openshift - register: g_versions_result - - - set_fact: - g_aos_versions: "{{ g_versions_result.stdout | from_yaml }}" - - - set_fact: - g_new_version: "{{ g_aos_versions.curr_version.split('-', 1).0 if g_aos_versions.avail_version is none else g_aos_versions.avail_version.split('-', 1).0 }}" - when: openshift_pkg_version is not defined - - - set_fact: - g_new_version: "{{ openshift_pkg_version | replace('-','') }}" - when: openshift_pkg_version is defined - - - fail: - msg: This playbook requires Origin 1.0.6 or later - when: deployment_type == 'origin' and g_aos_versions.curr_version | version_compare('1.0.6','<') - - - fail: - msg: Upgrade packages not found - when: (g_aos_versions.avail_version | default(g_aos_versions.curr_version, true) | version_compare(target_version, '<')) - - - set_fact: - pre_upgrade_complete: True - - -############################################################################## -# Gate on pre-upgrade checks -############################################################################## -- name: Gate on pre-upgrade checks - hosts: localhost - connection: local - become: no - vars: - pre_upgrade_hosts: "{{ groups.oo_masters_to_config | union(groups.oo_nodes_to_config) }}" - tasks: - - set_fact: - pre_upgrade_completed: "{{ hostvars - | oo_select_keys(pre_upgrade_hosts) - | oo_collect('inventory_hostname', {'pre_upgrade_complete': true}) }}" - - set_fact: - pre_upgrade_failed: "{{ pre_upgrade_hosts | difference(pre_upgrade_completed) }}" - - fail: - msg: "Upgrade cannot continue. The following hosts did not complete pre-upgrade checks: {{ pre_upgrade_failed | join(',') }}" - when: pre_upgrade_failed | length > 0 - - - -############################################################################### -# Backup etcd -############################################################################### -- name: Backup etcd - hosts: etcd_hosts_to_backup - vars: - embedded_etcd: "{{ openshift.master.embedded_etcd }}" - timestamp: "{{ lookup('pipe', 'date +%Y%m%d%H%M%S') }}" - roles: - - openshift_facts - tasks: - # Ensure we persist the etcd role for this host in openshift_facts - - openshift_facts: - role: etcd - local_facts: {} - when: "'etcd' not in openshift" - - - stat: path=/var/lib/openshift - register: var_lib_openshift - - - stat: path=/var/lib/origin - register: var_lib_origin - - - name: Create origin symlink if necessary - file: src=/var/lib/openshift/ dest=/var/lib/origin state=link - when: var_lib_openshift.stat.exists == True and var_lib_origin.stat.exists == False - - # TODO: replace shell module with command and update later checks - # We assume to be using the data dir for all backups. - - name: Check available disk space for etcd backup - shell: df --output=avail -k {{ openshift.common.data_dir }} | tail -n 1 - register: avail_disk - - # TODO: replace shell module with command and update later checks - - name: Check current embedded etcd disk usage - shell: du -k {{ openshift.etcd.etcd_data_dir }} | tail -n 1 | cut -f1 - register: etcd_disk_usage - when: embedded_etcd | bool - - - name: Abort if insufficient disk space for etcd backup - fail: - msg: > - {{ etcd_disk_usage.stdout }} Kb disk space required for etcd backup, - {{ avail_disk.stdout }} Kb available. - when: (embedded_etcd | bool) and (etcd_disk_usage.stdout|int > avail_disk.stdout|int) - - - name: Install etcd (for etcdctl) - action: "{{ ansible_pkg_mgr }} name=etcd state=latest" - - - name: Generate etcd backup - command: > - etcdctl backup --data-dir={{ openshift.etcd.etcd_data_dir }} - --backup-dir={{ openshift.common.data_dir }}/etcd-backup-{{ timestamp }} - - - set_fact: - etcd_backup_complete: True - - - name: Display location of etcd backup - debug: - msg: "Etcd backup created in {{ openshift.common.data_dir }}/etcd-backup-{{ timestamp }}" - - -############################################################################## -# Gate on etcd backup -############################################################################## -- name: Gate on etcd backup - hosts: localhost - connection: local - become: no - tasks: - - set_fact: - etcd_backup_completed: "{{ hostvars - | oo_select_keys(groups.etcd_hosts_to_backup) - | oo_collect('inventory_hostname', {'etcd_backup_complete': true}) }}" - - set_fact: - etcd_backup_failed: "{{ groups.etcd_hosts_to_backup | difference(etcd_backup_completed) }}" - - fail: - msg: "Upgrade cannot continue. The following hosts did not complete etcd backup: {{ etcd_backup_failed | join(',') }}" - when: etcd_backup_failed | length > 0 - - - -############################################################################### -# Upgrade Masters -############################################################################### -- name: Create temp directory for syncing certs - hosts: localhost - connection: local - become: no - gather_facts: no - tasks: - - name: Create local temp directory for syncing certs - local_action: command mktemp -d /tmp/openshift-ansible-XXXXXXX - register: g_master_mktemp - changed_when: False - -- name: Update deployment type - hosts: oo_masters_to_config:oo_nodes_to_config:oo_etcd_to_config - vars: - openshift_deployment_type: "{{ deployment_type }}" - roles: - - openshift_facts - -- name: Update master facts - hosts: oo_masters_to_config - roles: - - openshift_facts - post_tasks: - - openshift_facts: - role: master - local_facts: - cluster_method: "{{ openshift_master_cluster_method | default(None) }}" - -- name: Upgrade master packages and configuration - hosts: oo_masters_to_config - vars: - openshift_version: "{{ openshift_pkg_version | default('') }}" - roles: - - openshift_facts - tasks: - - name: Upgrade to latest available kernel - action: "{{ ansible_pkg_mgr}} name=kernel state=latest" - - - name: Upgrade master packages - command: "{{ ansible_pkg_mgr}} update -y {{ openshift.common.service_type }}-master{{ openshift_version }}" - when: openshift_pkg_version is not defined - - - name: Upgrade packages - command: "{{ ansible_pkg_mgr}} install -y {{ openshift.common.installed_variant_rpms | oo_31_rpm_rename_conversion(openshift_version) | join (' ')}}" - when: openshift_pkg_version is defined and deployment_type == 'openshift-enterprise' - - - name: Ensure python-yaml present for config upgrade - action: "{{ ansible_pkg_mgr }} name=PyYAML state=present" - when: not openshift.common.is_atomic | bool - - - name: Upgrade master configuration - openshift_upgrade_config: - from_version: '3.0' - to_version: '3.1' - role: master - config_base: "{{ hostvars[inventory_hostname].openshift.common.config_base }}" - - - set_fact: - openshift_master_certs_no_etcd: - - admin.crt - - master.kubelet-client.crt - - "{{ 'master.proxy-client.crt' if openshift.common.version_gte_3_1_or_1_1 else omit }}" - - master.server.crt - - openshift-master.crt - - openshift-registry.crt - - openshift-router.crt - - etcd.server.crt - openshift_master_certs_etcd: - - master.etcd-client.crt - - - set_fact: - openshift_master_certs: "{{ (openshift_master_certs_no_etcd | union(openshift_master_certs_etcd)) if (groups.oo_etcd_to_config is defined and groups.oo_etcd_to_config) else openshift_master_certs_no_etcd }}" - - - name: Check status of master certificates - stat: - path: "{{ openshift.common.config_base }}/master/{{ item }}" - with_items: openshift_master_certs - register: g_master_cert_stat_result - - - set_fact: - master_certs_missing: "{{ False in (g_master_cert_stat_result.results - | oo_collect(attribute='stat.exists') - | list ) }}" - master_cert_subdir: master-{{ openshift.common.hostname }} - master_cert_config_dir: "{{ openshift.common.config_base }}/master" - - -- name: Generate missing master certificates - hosts: oo_first_master - vars: - master_hostnames: "{{ hostvars - | oo_select_keys(groups.oo_masters_to_config) - | oo_collect('openshift.common.all_hostnames') - | oo_flatten | unique }}" - master_generated_certs_dir: "{{ openshift.common.config_base }}/generated-configs" - masters_needing_certs: "{{ hostvars - | oo_select_keys(groups['oo_masters_to_config'] | difference(groups['oo_first_master'])) - | oo_filter_list(filter_attr='master_certs_missing') }}" - sync_tmpdir: "{{ hostvars.localhost.g_master_mktemp.stdout }}" - openshift_deployment_type: "{{ deployment_type }}" - roles: - - openshift_master_certificates - post_tasks: - - name: Remove generated etcd client certs when using external etcd - file: - path: "{{ master_generated_certs_dir }}/{{ item.0.master_cert_subdir }}/{{ item.1 }}" - state: absent - when: groups.oo_etcd_to_config is defined and groups.oo_etcd_to_config - with_nested: - - masters_needing_certs - - - master.etcd-client.crt - - master.etcd-client.key - - - name: Create a tarball of the master certs - command: > - tar -czvf {{ master_generated_certs_dir }}/{{ item.master_cert_subdir }}.tgz - -C {{ master_generated_certs_dir }}/{{ item.master_cert_subdir }} . - with_items: masters_needing_certs - - - name: Retrieve the master cert tarball from the master - fetch: - src: "{{ master_generated_certs_dir }}/{{ item.master_cert_subdir }}.tgz" - dest: "{{ sync_tmpdir }}/" - flat: yes - fail_on_missing: yes - validate_checksum: yes - with_items: masters_needing_certs - - -- name: Sync generated certs, update service config and restart master services - hosts: oo_masters_to_config - vars: - sync_tmpdir: "{{ hostvars.localhost.g_master_mktemp.stdout }}" - openshift_master_ha: "{{ groups.oo_masters_to_config | length > 1 }}" - openshift_deployment_type: "{{ deployment_type }}" - tasks: - - name: Unarchive the tarball on the master - unarchive: - src: "{{ sync_tmpdir }}/{{ master_cert_subdir }}.tgz" - dest: "{{ master_cert_config_dir }}" - when: inventory_hostname != groups.oo_first_master.0 - - - name: Restart master service - service: name="{{ openshift.common.service_type}}-master" state=restarted - when: not openshift_master_ha | bool - - - name: Ensure the master service is enabled - service: name="{{ openshift.common.service_type}}-master" state=started enabled=yes - when: not openshift_master_ha | bool - - - name: Check for configured cluster - stat: - path: /etc/corosync/corosync.conf - register: corosync_conf - when: openshift_master_ha | bool - - - name: Destroy cluster - command: pcs cluster destroy --all - when: openshift_master_ha | bool and corosync_conf.stat.exists == true - run_once: true - - - name: Start pcsd - service: name=pcsd enabled=yes state=started - when: openshift_master_ha | bool - - -- name: Re-create cluster - hosts: oo_first_master - vars: - openshift_master_ha: "{{ groups.oo_masters_to_config | length > 1 }}" - openshift_deployment_type: "{{ deployment_type }}" - omc_cluster_hosts: "{{ groups.oo_masters_to_config | join(' ') }}" - roles: - - role: openshift_master_cluster - when: openshift_master_ha | bool - - -- name: Delete temporary directory on localhost - hosts: localhost - connection: local - become: no - gather_facts: no - tasks: - - file: name={{ g_master_mktemp.stdout }} state=absent - changed_when: False - - -- name: Set master update status to complete - hosts: oo_masters_to_config - tasks: - - set_fact: - master_update_complete: True - - -############################################################################## -# Gate on master update complete -############################################################################## -- name: Gate on master update - hosts: localhost - connection: local - become: no - tasks: - - set_fact: - master_update_completed: "{{ hostvars - | oo_select_keys(groups.oo_masters_to_config) - | oo_collect('inventory_hostname', {'master_update_complete': true}) }}" - - set_fact: - master_update_failed: "{{ groups.oo_masters_to_config | difference(master_update_completed) }}" - - fail: - msg: "Upgrade cannot continue. The following masters did not finish updating: {{ master_update_failed | join(',') }}" - when: master_update_failed | length > 0 - - -############################################################################### -# Upgrade Nodes -############################################################################### -- name: Upgrade nodes - hosts: oo_nodes_to_config - vars: - openshift_version: "{{ openshift_pkg_version | default('') }}" - roles: - - openshift_facts - tasks: - - name: Upgrade node packages - command: "{{ ansible_pkg_mgr }} update -y {{ openshift.common.service_type }}-node{{ openshift_version }}" - when: openshift_pkg_version is not defined - - - name: Upgrade packages - command: "{{ ansible_pkg_mgr}} install -y {{ openshift.common.installed_variant_rpms | oo_31_rpm_rename_conversion(openshift_version) | join (' ')}}" - when: openshift_pkg_version is defined and deployment_type == 'openshift-enterprise' - - - name: Restart node service - service: name="{{ openshift.common.service_type }}-node" state=restarted - - - name: Ensure node service enabled - service: name="{{ openshift.common.service_type }}-node" state=started enabled=yes - - - name: Install Ceph storage plugin dependencies - action: "{{ ansible_pkg_mgr }} name=ceph-common state=present" - - - name: Install GlusterFS storage plugin dependencies - action: "{{ ansible_pkg_mgr }} name=glusterfs-fuse state=present" - - - name: Set sebooleans to allow gluster storage plugin access from containers - seboolean: - name: "{{ item }}" - state: yes - persistent: yes - when: ansible_selinux and ansible_selinux.status == "enabled" - with_items: - - virt_use_fusefs - - virt_sandbox_use_fusefs - register: sebool_result - failed_when: "'state' not in sebool_result and 'msg' in sebool_result and 'SELinux boolean {{ item }} does not exist' not in sebool_result.msg" - - - set_fact: - node_update_complete: True - - -############################################################################## -# Gate on nodes update -############################################################################## -- name: Gate on nodes update - hosts: localhost - connection: local - become: no - tasks: - - set_fact: - node_update_completed: "{{ hostvars - | oo_select_keys(groups.oo_nodes_to_config) - | oo_collect('inventory_hostname', {'node_update_complete': true}) }}" - - set_fact: - node_update_failed: "{{ groups.oo_nodes_to_config | difference(node_update_completed) }}" - - fail: - msg: "Upgrade cannot continue. The following nodes did not finish updating: {{ node_update_failed | join(',') }}" - when: node_update_failed | length > 0 - - -############################################################################### -# Post upgrade - Reconcile Cluster Roles and Cluster Role Bindings -############################################################################### -- name: Reconcile Cluster Roles and Cluster Role Bindings - hosts: oo_masters_to_config - vars: - origin_reconcile_bindings: "{{ deployment_type == 'origin' and g_new_version | version_compare('1.0.6', '>') }}" - ent_reconcile_bindings: true - openshift_master_ha: "{{ groups.oo_masters_to_config | length > 1 }}" - tasks: - - name: Reconcile Cluster Roles - command: > - {{ openshift.common.admin_binary}} --config={{ openshift.common.config_base }}/master/admin.kubeconfig - policy reconcile-cluster-roles --additive-only=true --confirm - run_once: true - - - name: Reconcile Cluster Role Bindings - command: > - {{ openshift.common.admin_binary}} --config={{ openshift.common.config_base }}/master/admin.kubeconfig - policy reconcile-cluster-role-bindings - --exclude-groups=system:authenticated - --exclude-groups=system:authenticated:oauth - --exclude-groups=system:unauthenticated - --exclude-users=system:anonymous - --additive-only=true --confirm - when: origin_reconcile_bindings | bool or ent_reconcile_bindings | bool - run_once: true - - - name: Restart master services - service: name="{{ openshift.common.service_type}}-master" state=restarted - when: not openshift_master_ha | bool - - - name: Restart master cluster - command: pcs resource restart master - when: openshift_master_ha | bool - run_once: true - - - name: Wait for the clustered master service to be available - wait_for: - host: "{{ openshift_master_cluster_vip }}" - port: 8443 - state: started - timeout: 180 - delay: 90 - when: openshift_master_ha | bool - run_once: true - - - set_fact: - reconcile_complete: True - - -############################################################################## -# Gate on reconcile -############################################################################## -- name: Gate on reconcile - hosts: localhost - connection: local - become: no - tasks: - - set_fact: - reconcile_completed: "{{ hostvars - | oo_select_keys(groups.oo_masters_to_config) - | oo_collect('inventory_hostname', {'reconcile_complete': true}) }}" - - set_fact: - reconcile_failed: "{{ groups.oo_masters_to_config | difference(reconcile_completed) }}" - - fail: - msg: "Upgrade cannot continue. The following masters did not finish reconciling: {{ reconcile_failed | join(',') }}" - when: reconcile_failed | length > 0 - - - - -############################################################################### -# Post upgrade - Upgrade default router, default registry and examples -############################################################################### -- name: Upgrade default router and default registry - hosts: oo_first_master - vars: - openshift_deployment_type: "{{ deployment_type }}" - registry_image: "{{ openshift.master.registry_url | replace( '${component}', 'docker-registry' ) | replace ( '${version}', 'v' + g_new_version ) }}" - router_image: "{{ openshift.master.registry_url | replace( '${component}', 'haproxy-router' ) | replace ( '${version}', 'v' + g_new_version ) }}" - oc_cmd: "{{ openshift.common.client_binary }} --config={{ openshift.common.config_base }}/master/admin.kubeconfig" - roles: - # Create the new templates shipped in 3.1, existing templates are left - # unmodified. This prevents the subsequent role definition for - # openshift_examples from failing when trying to replace templates that do - # not already exist. We could have potentially done a replace --force to - # create and update in one step. - - openshift_examples - # Update the existing templates - - role: openshift_examples - openshift_examples_import_command: replace - pre_tasks: - - name: Collect all routers - command: > - {{ oc_cmd }} get pods --all-namespaces -l 'router' -o json - register: all_routers - failed_when: false - changed_when: false - - - set_fact: haproxy_routers="{{ (all_routers.stdout | from_json)['items'] | oo_pods_match_component(openshift_deployment_type, 'haproxy-router') | oo_select_keys_from_list(['metadata']) }}" - when: all_routers.rc == 0 - - - set_fact: haproxy_routers=[] - when: all_routers.rc != 0 - - - name: Check for allowHostNetwork and allowHostPorts - when: all_routers.rc == 0 - shell: > - {{ oc_cmd }} get -o yaml scc/privileged | /usr/bin/grep -e allowHostPorts -e allowHostNetwork - register: _scc - - - name: Grant allowHostNetwork and allowHostPorts - when: - - all_routers.rc == 0 - - "'false' in _scc.stdout" - command: > - {{ oc_cmd }} patch scc/privileged -p - '{"allowHostPorts":true,"allowHostNetwork":true}' --api-version=v1 - - - name: Update deployment config to 1.0.4/3.0.1 spec - when: all_routers.rc == 0 - command: > - {{ oc_cmd }} patch dc/{{ item['labels']['deploymentconfig'] }} -p - '{"spec":{"strategy":{"rollingParams":{"updatePercent":-10},"spec":{"serviceAccount":"router","serviceAccountName":"router"}}}}' - --api-version=v1 - with_items: haproxy_routers - - - name: Switch to hostNetwork=true - when: all_routers.rc == 0 - command: > - {{ oc_cmd }} patch dc/{{ item['labels']['deploymentconfig'] }} -p '{"spec":{"template":{"spec":{"hostNetwork":true}}}}' - --api-version=v1 - with_items: haproxy_routers - - - name: Update router image to current version - when: all_routers.rc == 0 - command: > - {{ oc_cmd }} patch dc/{{ item['labels']['deploymentconfig'] }} -p - '{"spec":{"template":{"spec":{"containers":[{"name":"router","image":"{{ router_image }}"}]}}}}' - --api-version=v1 - with_items: haproxy_routers - when: not openshift.common.version_gte_3_1_1_or_1_1_1 - - - name: Update router image to current version - when: all_routers.rc == 0 - command: > - {{ oc_cmd }} patch dc/{{ item['labels']['deploymentconfig'] }} -p - '{"spec":{"template":{"spec":{"containers":[{"name":"router","image":"{{ router_image }}","livenessProbe":{"tcpSocket":null,"httpGet":{"path": "/healthz", "port": 1936, "host": "localhost", "scheme": "HTTP"},"initialDelaySeconds":10,"timeoutSeconds":1}}]}}}}' - --api-version=v1 - with_items: haproxy_routers - when: openshift.common.version_gte_3_1_1_or_1_1_1 - - - name: Check for default registry - command: > - {{ oc_cmd }} get -n default dc/docker-registry - register: _default_registry - failed_when: false - changed_when: false - - - name: Update registry image to current version - when: _default_registry.rc == 0 - command: > - {{ oc_cmd }} patch dc/docker-registry -p - '{"spec":{"template":{"spec":{"containers":[{"name":"registry","image":"{{ registry_image }}"}]}}}}' - --api-version=v1 diff --git a/playbooks/common/openshift-cluster/upgrades/v3_1_minor/upgrade.yml b/playbooks/common/openshift-cluster/upgrades/v3_1_minor/upgrade.yml deleted file mode 100644 index e5cfa58aa..000000000 --- a/playbooks/common/openshift-cluster/upgrades/v3_1_minor/upgrade.yml +++ /dev/null @@ -1,140 +0,0 @@ ---- -############################################################################### -# The restart playbook should be run after this playbook completes. -############################################################################### - -############################################################################### -# Upgrade Masters -############################################################################### -- name: Upgrade master packages and configuration - hosts: oo_masters_to_config - vars: - openshift_version: "{{ openshift_pkg_version | default('') }}" - tasks: - - name: Upgrade master packages - command: "{{ ansible_pkg_mgr}} update-to -y {{ openshift.common.service_type }}-master{{ openshift_version }} {{ openshift.common.service_type }}-sdn-ovs{{ openshift_version }}" - when: not openshift.common.is_containerized | bool - - - name: Ensure python-yaml present for config upgrade - action: "{{ ansible_pkg_mgr }} name=PyYAML state=present" - when: not openshift.common.is_containerized | bool - -# Currently 3.1.1 does not have any new configuration settings -# -# - name: Upgrade master configuration -# openshift_upgrade_config: -# from_version: '3.0' -# to_version: '3.1' -# role: master -# config_base: "{{ hostvars[inventory_hostname].openshift.common.config_base }}" - -- name: Set master update status to complete - hosts: oo_masters_to_config - tasks: - - set_fact: - master_update_complete: True - -############################################################################## -# Gate on master update complete -############################################################################## -- name: Gate on master update - hosts: localhost - connection: local - become: no - tasks: - - set_fact: - master_update_completed: "{{ hostvars - | oo_select_keys(groups.oo_masters_to_config) - | oo_collect('inventory_hostname', {'master_update_complete': true}) }}" - - set_fact: - master_update_failed: "{{ groups.oo_masters_to_config | difference(master_update_completed) }}" - - fail: - msg: "Upgrade cannot continue. The following masters did not finish updating: {{ master_update_failed | join(',') }}" - when: master_update_failed | length > 0 - -############################################################################### -# Upgrade Nodes -############################################################################### -- name: Upgrade nodes - hosts: oo_nodes_to_config - vars: - openshift_version: "{{ openshift_pkg_version | default('') }}" - roles: - - openshift_facts - tasks: - - name: Upgrade node packages - command: "{{ ansible_pkg_mgr }} update-to -y {{ openshift.common.service_type }}-node{{ openshift_version }} {{ openshift.common.service_type }}-sdn-ovs{{ openshift_version }}" - when: not openshift.common.is_containerized | bool - - - name: Restart node service - service: name="{{ openshift.common.service_type }}-node" state=restarted - - - set_fact: - node_update_complete: True - -############################################################################## -# Gate on nodes update -############################################################################## -- name: Gate on nodes update - hosts: localhost - connection: local - become: no - tasks: - - set_fact: - node_update_completed: "{{ hostvars - | oo_select_keys(groups.oo_nodes_to_config) - | oo_collect('inventory_hostname', {'node_update_complete': true}) }}" - - set_fact: - node_update_failed: "{{ groups.oo_nodes_to_config | difference(node_update_completed) }}" - - fail: - msg: "Upgrade cannot continue. The following nodes did not finish updating: {{ node_update_failed | join(',') }}" - when: node_update_failed | length > 0 - -############################################################################### -# Reconcile Cluster Roles and Cluster Role Bindings -############################################################################### -- name: Reconcile Cluster Roles and Cluster Role Bindings - hosts: oo_masters_to_config - vars: - origin_reconcile_bindings: "{{ deployment_type == 'origin' and g_new_version | version_compare('1.0.6', '>') }}" - ent_reconcile_bindings: true - openshift_master_ha: "{{ groups.oo_masters_to_config | length > 1 }}" - tasks: - - name: Reconcile Cluster Roles - command: > - {{ openshift.common.admin_binary}} --config={{ openshift.common.config_base }}/master/admin.kubeconfig - policy reconcile-cluster-roles --additive-only=true --confirm - run_once: true - - - name: Reconcile Cluster Role Bindings - command: > - {{ openshift.common.admin_binary}} --config={{ openshift.common.config_base }}/master/admin.kubeconfig - policy reconcile-cluster-role-bindings - --exclude-groups=system:authenticated - --exclude-groups=system:authenticated:oauth - --exclude-groups=system:unauthenticated - --exclude-users=system:anonymous - --additive-only=true --confirm - when: origin_reconcile_bindings | bool or ent_reconcile_bindings | bool - run_once: true - - - set_fact: - reconcile_complete: True - -############################################################################## -# Gate on reconcile -############################################################################## -- name: Gate on reconcile - hosts: localhost - connection: local - become: no - tasks: - - set_fact: - reconcile_completed: "{{ hostvars - | oo_select_keys(groups.oo_masters_to_config) - | oo_collect('inventory_hostname', {'reconcile_complete': true}) }}" - - set_fact: - reconcile_failed: "{{ groups.oo_masters_to_config | difference(reconcile_completed) }}" - - fail: - msg: "Upgrade cannot continue. The following masters did not finish reconciling: {{ reconcile_failed | join(',') }}" - when: reconcile_failed | length > 0 -- cgit v1.2.3 From 78dd487871796a71c450a1a1daf78b079a3a1090 Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Thu, 16 Jun 2016 14:27:20 -0300 Subject: Cleanup, fix 3.1 version bug in facts. --- playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/pre.yml | 5 ++--- .../common/openshift-cluster/upgrades/v3_1_to_v3_2/rpm_upgrade.yml | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) (limited to 'playbooks/common') 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 a5a9a0fec..e5a1d30f7 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 @@ -206,10 +206,9 @@ g_docker_version: "{{ g_atomic_docker_version_result.stdout | from_yaml }}" when: openshift.common.is_atomic | bool - # TODO: Update to 1.10 once branch merges - fail: - msg: This playbook requires access to Docker 1.9 or later - when: g_docker_version.avail_version | default(g_docker_version.curr_version, true) | version_compare('1.9','<') + msg: This playbook requires access to Docker 1.10 or later + when: g_docker_version.avail_version | default(g_docker_version.curr_version, true) | version_compare('1.10','<') # TODO: add check to upgrade ostree to get latest Docker diff --git a/playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/rpm_upgrade.yml b/playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/rpm_upgrade.yml index ea27a40d1..1d97d3802 100644 --- a/playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/rpm_upgrade.yml +++ b/playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/rpm_upgrade.yml @@ -1,4 +1,4 @@ -# TODO: Use a specific version here once we're setting openshift_pkg_version reliably in the openshift_version module. +# We verified latest rpm available is suitable, so just yum update. - name: Upgrade packages command: "{{ ansible_pkg_mgr}} update -y {{ openshift.common.service_type }}-{{ component }}" -- cgit v1.2.3 From b4d702c0115cb97f118e1fdc77f6326eda923a47 Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Fri, 17 Jun 2016 09:10:00 -0300 Subject: Upgrade fixes. --- .../upgrades/v3_1_to_v3_2/post.yml | 4 ++-- .../upgrades/v3_1_to_v3_2/upgrade.yml | 27 +++------------------- 2 files changed, 5 insertions(+), 26 deletions(-) (limited to 'playbooks/common') diff --git a/playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/post.yml b/playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/post.yml index 31e76805c..d52fd7cb0 100644 --- a/playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/post.yml +++ b/playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/post.yml @@ -6,8 +6,8 @@ hosts: oo_first_master vars: openshift_deployment_type: "{{ deployment_type }}" - registry_image: "{{ openshift.master.registry_url | replace( '${component}', 'docker-registry' ) | replace ( '${version}', 'v' + g_new_version ) }}" - router_image: "{{ openshift.master.registry_url | replace( '${component}', 'haproxy-router' ) | replace ( '${version}', 'v' + g_new_version ) }}" + registry_image: "{{ openshift.master.registry_url | replace( '${component}', 'docker-registry' ) | replace ( '${version}', openshift_image_tag ) }}" + router_image: "{{ openshift.master.registry_url | replace( '${component}', 'haproxy-router' ) | replace ( '${version}', openshift_image_tag ) }}" oc_cmd: "{{ openshift.common.client_binary }} --config={{ openshift.common.config_base }}/master/admin.kubeconfig" roles: - openshift_manageiq diff --git a/playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/upgrade.yml b/playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/upgrade.yml index 7b5b9e8d7..66f6f8e71 100644 --- a/playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/upgrade.yml +++ b/playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/upgrade.yml @@ -13,29 +13,8 @@ - name: Set post docker install facts openshift_facts: role: "{{ item.role }}" - local_facts: "{{ item.local_facts }}" with_items: - role: docker - local_facts: - openshift_image_tag: "v{{ g_new_version }}" - openshift_version: "{{ g_new_version }}" - -# The cli image is used by openshift_docker_facts to determine the currently installed -# version. We need to explicitly pull the latest image to handle cases where -# the locally cached 'latest' tag is older the g_new_version. -- name: Download cli image - hosts: oo_masters_to_config:oo_nodes_to_config - roles: - - { role: openshift_docker_facts } - vars: - openshift_docker_hosted_registry_network: "{{ hostvars[groups.oo_first_master.0].openshift.common.portal_net }}" - tasks: - - name: Pull Images - command: > - docker pull {{ item }}:latest - with_items: - - "{{ openshift.common.cli_image }}" - when: openshift.common.is_containerized | bool ############################################################################### # Upgrade Masters @@ -53,7 +32,7 @@ - include_vars: ../../../../../roles/openshift_master/vars/main.yml - name: Update systemd units - include: ../../../../../roles/openshift_master/tasks/systemd_units.yml openshift_version=v{{ g_new_version }} + include: ../../../../../roles/openshift_master/tasks/systemd_units.yml # - name: Upgrade master configuration # openshift_upgrade_config: @@ -127,9 +106,9 @@ - name: Reconcile Cluster Roles and Cluster Role Bindings and Security Context Constraints hosts: oo_masters_to_config roles: - - { role: openshift_cli, openshift_image_tag: "v{{ g_new_version }}" } + - { role: openshift_cli } vars: - origin_reconcile_bindings: "{{ deployment_type == 'origin' and g_new_version | version_compare('1.0.6', '>') }}" + origin_reconcile_bindings: "{{ deployment_type == 'origin' and openshift_version | version_compare('1.0.6', '>') }}" ent_reconcile_bindings: true openshift_docker_hosted_registry_network: "{{ hostvars[groups.oo_first_master.0].openshift.common.portal_net }}" tasks: -- cgit v1.2.3 From 8c9ed6719bdbc0ce7574fa9261c60e4978c203e6 Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Mon, 20 Jun 2016 14:45:42 -0300 Subject: Fix docker restarts during openshift_version role. The variable here must be explicitly passed to the docker role, if it's passed sometimes and not others, the docker config changes triggers a docker restart effectively killing everything on the node in an unsafe manner. Instead lets make sure the value is set. --- playbooks/common/openshift-cluster/initialize_facts.yml | 2 ++ playbooks/common/openshift-master/config.yml | 2 -- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'playbooks/common') diff --git a/playbooks/common/openshift-cluster/initialize_facts.yml b/playbooks/common/openshift-cluster/initialize_facts.yml index cda490b1f..a4af5efc5 100644 --- a/playbooks/common/openshift-cluster/initialize_facts.yml +++ b/playbooks/common/openshift-cluster/initialize_facts.yml @@ -8,3 +8,5 @@ role: common local_facts: hostname: "{{ openshift_hostname | default(None) }}" + - set_fact: + openshift_docker_hosted_registry_network: "{{ hostvars[groups.oo_first_master.0].openshift.common.portal_net }}" diff --git a/playbooks/common/openshift-master/config.yml b/playbooks/common/openshift-master/config.yml index 5e57cdeef..f17f6a1e9 100644 --- a/playbooks/common/openshift-master/config.yml +++ b/playbooks/common/openshift-master/config.yml @@ -204,7 +204,6 @@ | oo_collect('openshift.common.all_hostnames') | oo_flatten | unique }}" sync_tmpdir: "{{ hostvars.localhost.g_master_mktemp.stdout }}" - openshift_docker_hosted_registry_network: "{{ hostvars[groups.oo_first_master.0].openshift.common.portal_net }}" roles: - openshift_master_certificates post_tasks: @@ -320,7 +319,6 @@ openshift_master_count: "{{ openshift.master.master_count }}" openshift_master_session_auth_secrets: "{{ hostvars[groups.oo_first_master.0].openshift.master.session_auth_secrets }}" openshift_master_session_encryption_secrets: "{{ hostvars[groups.oo_first_master.0].openshift.master.session_encryption_secrets }}" - openshift_docker_hosted_registry_network: "{{ hostvars[groups.oo_first_master.0].openshift.common.portal_net }}" openshift_no_proxy_internal_hostnames: "{{ hostvars | oo_select_keys(groups['oo_nodes_to_config'] | union(groups['oo_masters_to_config']) | union(groups['oo_etcd_to_config'] | default([]))) -- cgit v1.2.3 From 2a52c5e57646b78d703aea1fd8e51ce2e90c7722 Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Tue, 21 Jun 2016 10:02:05 -0300 Subject: Remove more legacy upgrade playbooks. --- .../upgrades/v3_0_minor/filter_plugins | 1 - .../openshift-cluster/upgrades/v3_0_minor/library | 1 - .../upgrades/v3_0_minor/lookup_plugins | 1 - .../openshift-cluster/upgrades/v3_0_minor/roles | 1 - .../upgrades/v3_0_to_v3_1/filter_plugins | 1 - .../upgrades/v3_0_to_v3_1/library | 1 - .../upgrades/v3_0_to_v3_1/lookup_plugins | 1 - .../openshift-cluster/upgrades/v3_0_to_v3_1/roles | 1 - .../upgrades/v3_1_minor/filter_plugins | 1 - .../openshift-cluster/upgrades/v3_1_minor/library | 1 - .../upgrades/v3_1_minor/lookup_plugins | 1 - .../openshift-cluster/upgrades/v3_1_minor/post.yml | 57 -------------- .../openshift-cluster/upgrades/v3_1_minor/pre.yml | 88 ---------------------- .../openshift-cluster/upgrades/v3_1_minor/roles | 1 - 14 files changed, 157 deletions(-) delete mode 120000 playbooks/common/openshift-cluster/upgrades/v3_0_minor/filter_plugins delete mode 120000 playbooks/common/openshift-cluster/upgrades/v3_0_minor/library delete mode 120000 playbooks/common/openshift-cluster/upgrades/v3_0_minor/lookup_plugins delete mode 120000 playbooks/common/openshift-cluster/upgrades/v3_0_minor/roles delete mode 120000 playbooks/common/openshift-cluster/upgrades/v3_0_to_v3_1/filter_plugins delete mode 120000 playbooks/common/openshift-cluster/upgrades/v3_0_to_v3_1/library delete mode 120000 playbooks/common/openshift-cluster/upgrades/v3_0_to_v3_1/lookup_plugins delete mode 120000 playbooks/common/openshift-cluster/upgrades/v3_0_to_v3_1/roles delete mode 120000 playbooks/common/openshift-cluster/upgrades/v3_1_minor/filter_plugins delete mode 120000 playbooks/common/openshift-cluster/upgrades/v3_1_minor/library delete mode 120000 playbooks/common/openshift-cluster/upgrades/v3_1_minor/lookup_plugins delete mode 100644 playbooks/common/openshift-cluster/upgrades/v3_1_minor/post.yml delete mode 100644 playbooks/common/openshift-cluster/upgrades/v3_1_minor/pre.yml delete mode 120000 playbooks/common/openshift-cluster/upgrades/v3_1_minor/roles (limited to 'playbooks/common') diff --git a/playbooks/common/openshift-cluster/upgrades/v3_0_minor/filter_plugins b/playbooks/common/openshift-cluster/upgrades/v3_0_minor/filter_plugins deleted file mode 120000 index 27ddaa18b..000000000 --- a/playbooks/common/openshift-cluster/upgrades/v3_0_minor/filter_plugins +++ /dev/null @@ -1 +0,0 @@ -../../../../../filter_plugins \ No newline at end of file diff --git a/playbooks/common/openshift-cluster/upgrades/v3_0_minor/library b/playbooks/common/openshift-cluster/upgrades/v3_0_minor/library deleted file mode 120000 index 53bed9684..000000000 --- a/playbooks/common/openshift-cluster/upgrades/v3_0_minor/library +++ /dev/null @@ -1 +0,0 @@ -../library \ No newline at end of file diff --git a/playbooks/common/openshift-cluster/upgrades/v3_0_minor/lookup_plugins b/playbooks/common/openshift-cluster/upgrades/v3_0_minor/lookup_plugins deleted file mode 120000 index cf407f69b..000000000 --- a/playbooks/common/openshift-cluster/upgrades/v3_0_minor/lookup_plugins +++ /dev/null @@ -1 +0,0 @@ -../../../../../lookup_plugins \ No newline at end of file diff --git a/playbooks/common/openshift-cluster/upgrades/v3_0_minor/roles b/playbooks/common/openshift-cluster/upgrades/v3_0_minor/roles deleted file mode 120000 index 6bc1a7aef..000000000 --- a/playbooks/common/openshift-cluster/upgrades/v3_0_minor/roles +++ /dev/null @@ -1 +0,0 @@ -../../../../../roles \ No newline at end of file diff --git a/playbooks/common/openshift-cluster/upgrades/v3_0_to_v3_1/filter_plugins b/playbooks/common/openshift-cluster/upgrades/v3_0_to_v3_1/filter_plugins deleted file mode 120000 index 27ddaa18b..000000000 --- a/playbooks/common/openshift-cluster/upgrades/v3_0_to_v3_1/filter_plugins +++ /dev/null @@ -1 +0,0 @@ -../../../../../filter_plugins \ No newline at end of file diff --git a/playbooks/common/openshift-cluster/upgrades/v3_0_to_v3_1/library b/playbooks/common/openshift-cluster/upgrades/v3_0_to_v3_1/library deleted file mode 120000 index 53bed9684..000000000 --- a/playbooks/common/openshift-cluster/upgrades/v3_0_to_v3_1/library +++ /dev/null @@ -1 +0,0 @@ -../library \ No newline at end of file diff --git a/playbooks/common/openshift-cluster/upgrades/v3_0_to_v3_1/lookup_plugins b/playbooks/common/openshift-cluster/upgrades/v3_0_to_v3_1/lookup_plugins deleted file mode 120000 index cf407f69b..000000000 --- a/playbooks/common/openshift-cluster/upgrades/v3_0_to_v3_1/lookup_plugins +++ /dev/null @@ -1 +0,0 @@ -../../../../../lookup_plugins \ No newline at end of file diff --git a/playbooks/common/openshift-cluster/upgrades/v3_0_to_v3_1/roles b/playbooks/common/openshift-cluster/upgrades/v3_0_to_v3_1/roles deleted file mode 120000 index 6bc1a7aef..000000000 --- a/playbooks/common/openshift-cluster/upgrades/v3_0_to_v3_1/roles +++ /dev/null @@ -1 +0,0 @@ -../../../../../roles \ No newline at end of file diff --git a/playbooks/common/openshift-cluster/upgrades/v3_1_minor/filter_plugins b/playbooks/common/openshift-cluster/upgrades/v3_1_minor/filter_plugins deleted file mode 120000 index 27ddaa18b..000000000 --- a/playbooks/common/openshift-cluster/upgrades/v3_1_minor/filter_plugins +++ /dev/null @@ -1 +0,0 @@ -../../../../../filter_plugins \ No newline at end of file diff --git a/playbooks/common/openshift-cluster/upgrades/v3_1_minor/library b/playbooks/common/openshift-cluster/upgrades/v3_1_minor/library deleted file mode 120000 index 53bed9684..000000000 --- a/playbooks/common/openshift-cluster/upgrades/v3_1_minor/library +++ /dev/null @@ -1 +0,0 @@ -../library \ No newline at end of file diff --git a/playbooks/common/openshift-cluster/upgrades/v3_1_minor/lookup_plugins b/playbooks/common/openshift-cluster/upgrades/v3_1_minor/lookup_plugins deleted file mode 120000 index cf407f69b..000000000 --- a/playbooks/common/openshift-cluster/upgrades/v3_1_minor/lookup_plugins +++ /dev/null @@ -1 +0,0 @@ -../../../../../lookup_plugins \ No newline at end of file diff --git a/playbooks/common/openshift-cluster/upgrades/v3_1_minor/post.yml b/playbooks/common/openshift-cluster/upgrades/v3_1_minor/post.yml deleted file mode 100644 index 196393b2a..000000000 --- a/playbooks/common/openshift-cluster/upgrades/v3_1_minor/post.yml +++ /dev/null @@ -1,57 +0,0 @@ ---- -############################################################################### -# Post upgrade - Upgrade default router, default registry and examples -############################################################################### -- name: Upgrade default router and default registry - hosts: oo_first_master - vars: - openshift_deployment_type: "{{ deployment_type }}" - registry_image: "{{ openshift.master.registry_url | replace( '${component}', 'docker-registry' ) | replace ( '${version}', 'v' + g_new_version ) }}" - router_image: "{{ openshift.master.registry_url | replace( '${component}', 'haproxy-router' ) | replace ( '${version}', 'v' + g_new_version ) }}" - oc_cmd: "{{ openshift.common.client_binary }} --config={{ openshift.common.config_base }}/master/admin.kubeconfig" - roles: - # Create the new templates shipped in 3.1.z, existing templates are left - # unmodified. This prevents the subsequent role definition for - # openshift_examples from failing when trying to replace templates that do - # not already exist. We could have potentially done a replace --force to - # create and update in one step. - - openshift_examples - # Update the existing templates - - role: openshift_examples - openshift_examples_import_command: replace - pre_tasks: - - name: Collect all routers - command: > - {{ oc_cmd }} get pods --all-namespaces -l 'router' -o json - register: all_routers - failed_when: false - changed_when: false - - - set_fact: haproxy_routers="{{ (all_routers.stdout | from_json)['items'] | oo_pods_match_component(openshift_deployment_type, 'haproxy-router') | oo_select_keys_from_list(['metadata']) }}" - when: all_routers.rc == 0 - - - set_fact: haproxy_routers=[] - when: all_routers.rc != 0 - - - name: Update router image to current version - when: all_routers.rc == 0 - command: > - {{ oc_cmd }} patch dc/{{ item['labels']['deploymentconfig'] }} -p - '{"spec":{"template":{"spec":{"containers":[{"name":"router","image":"{{ router_image }}","livenessProbe":{"tcpSocket":null,"httpGet":{"path": "/healthz", "port": 1936, "host": "localhost", "scheme": "HTTP"},"initialDelaySeconds":10,"timeoutSeconds":1}}]}}}}' - --api-version=v1 - with_items: haproxy_routers - - - name: Check for default registry - command: > - {{ oc_cmd }} get -n default dc/docker-registry - register: _default_registry - failed_when: false - changed_when: false - - - name: Update registry image to current version - when: _default_registry.rc == 0 - command: > - {{ oc_cmd }} patch dc/docker-registry -p - '{"spec":{"template":{"spec":{"containers":[{"name":"registry","image":"{{ registry_image }}"}]}}}}' - --api-version=v1 - diff --git a/playbooks/common/openshift-cluster/upgrades/v3_1_minor/pre.yml b/playbooks/common/openshift-cluster/upgrades/v3_1_minor/pre.yml deleted file mode 100644 index 85d7073f2..000000000 --- a/playbooks/common/openshift-cluster/upgrades/v3_1_minor/pre.yml +++ /dev/null @@ -1,88 +0,0 @@ ---- -############################################################################### -# Evaluate host groups and gather facts -############################################################################### -- name: Load openshift_facts - hosts: oo_masters_to_config:oo_nodes_to_config:oo_etcd_to_config:oo_lb_to_config - roles: - - openshift_facts - -############################################################################### -# Pre-upgrade checks -############################################################################### -- name: Verify upgrade can proceed - hosts: oo_first_master - vars: - openshift_master_ha: "{{ groups.oo_masters_to_config | length > 1 }}" - target_version: "{{ '1.1.1' if deployment_type == 'origin' else '3.1.1' }}" - gather_facts: no - tasks: - - fail: - msg: > - This upgrade is only supported for origin, openshift-enterprise, and online - deployment types - when: deployment_type not in ['origin','openshift-enterprise', 'online'] - - - fail: - msg: > - openshift_pkg_version is {{ openshift_pkg_version }} which is not a - valid version for a {{ target_version }} upgrade - when: openshift_pkg_version is defined and openshift_pkg_version.split('-',1).1 | version_compare(target_version ,'<') - -- name: Verify upgrade targets - hosts: oo_masters_to_config:oo_nodes_to_config - vars: - target_version: "{{ '1.1.1' if deployment_type == 'origin' else '3.1.1' }}" - tasks: - - name: Clean package cache - command: "{{ ansible_pkg_mgr }} clean all" - when: not openshift.common.is_atomic | bool - - - set_fact: - g_new_service_name: "{{ 'origin' if deployment_type =='origin' else 'atomic-openshift' }}" - - - name: Determine available versions - script: ../files/rpm_versions.sh {{ g_new_service_name }} - register: g_versions_result - - - set_fact: - g_aos_versions: "{{ g_versions_result.stdout | from_yaml }}" - - - set_fact: - g_new_version: "{{ g_aos_versions.curr_version.split('-', 1).0 if g_aos_versions.avail_version is none else g_aos_versions.avail_version.split('-', 1).0 }}" - - - fail: - msg: This playbook requires Origin 1.1 or later - when: deployment_type == 'origin' and g_aos_versions.curr_version | version_compare('1.1','<') - - - fail: - msg: This playbook requires Atomic Enterprise Platform/OpenShift Enterprise 3.1 or later - when: deployment_type == 'atomic-openshift' and g_aos_versions.curr_version | version_compare('3.1','<') - - - fail: - msg: Upgrade packages not found - when: (g_aos_versions.avail_version | default(g_aos_versions.curr_version, true) | version_compare(target_version, '<')) - - - set_fact: - pre_upgrade_complete: True - - -############################################################################## -# Gate on pre-upgrade checks -############################################################################## -- name: Gate on pre-upgrade checks - hosts: localhost - connection: local - become: no - vars: - pre_upgrade_hosts: "{{ groups.oo_masters_to_config | union(groups.oo_nodes_to_config) }}" - tasks: - - set_fact: - pre_upgrade_completed: "{{ hostvars - | oo_select_keys(pre_upgrade_hosts) - | oo_collect('inventory_hostname', {'pre_upgrade_complete': true}) }}" - - set_fact: - pre_upgrade_failed: "{{ pre_upgrade_hosts | difference(pre_upgrade_completed) }}" - - fail: - msg: "Upgrade cannot continue. The following hosts did not complete pre-upgrade checks: {{ pre_upgrade_failed | join(',') }}" - when: pre_upgrade_failed | length > 0 diff --git a/playbooks/common/openshift-cluster/upgrades/v3_1_minor/roles b/playbooks/common/openshift-cluster/upgrades/v3_1_minor/roles deleted file mode 120000 index 6bc1a7aef..000000000 --- a/playbooks/common/openshift-cluster/upgrades/v3_1_minor/roles +++ /dev/null @@ -1 +0,0 @@ -../../../../../roles \ No newline at end of file -- cgit v1.2.3 From 50c5e7ac797313537dd31a528f187063b54a903f Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Tue, 21 Jun 2016 11:05:27 -0300 Subject: Fix use of v3.2 format for openshift_release in upgrade. --- playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/pre.yml | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'playbooks/common') 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 e5a1d30f7..d8d04470c 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 @@ -58,6 +58,10 @@ valid version for a {{ target_version }} upgrade when: openshift_image_tag is defined and openshift_image_tag.split('v',1).1 | version_compare(target_version ,'<') + - set_fact: + openshift_release: "{{ openshift_release[1:] }}" + when: openshift_release is defined and openshift_release[0] == 'v' + - fail: msg: > openshift_release is {{ openshift_release }} which is not a -- cgit v1.2.3 From b5f5b88221d5976d71c0a0a70e73fd353c7419a9 Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Tue, 21 Jun 2016 13:37:42 -0300 Subject: Use common fact initialization include in upgrade. --- playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/pre.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'playbooks/common') 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 d8d04470c..cdc691829 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 @@ -2,10 +2,12 @@ ############################################################################### # Evaluate host groups and gather facts ############################################################################### -- name: Load openshift_facts and update repos + +- include: ../../common/openshift-cluster/initialize_facts.yml + +- name: Update repos hosts: oo_masters_to_config:oo_nodes_to_config:oo_etcd_to_config:oo_lb_to_config roles: - - openshift_facts - openshift_repos - name: Evaluate additional groups for upgrade -- cgit v1.2.3 From 5c7e3e9d3a36062a6bf0d79da0c95e1f2e17b9a0 Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Wed, 22 Jun 2016 11:28:19 -0300 Subject: Update docker upgrade playbook to be more flexible. Now more of a generic upgrade playbook to go to the latest Docker version. Added support for docker_version inventory variable, in which case we disable the check for >= 1.10 and make sure you're running at least the specified version. (we will not downgrade you to the requested version however, this is much too complicated) --- playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/pre.yml | 1 - 1 file changed, 1 deletion(-) (limited to 'playbooks/common') 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 6a3d60276..ec07f0a60 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 @@ -163,7 +163,6 @@ - set_fact: repoquery_cmd: "{{ 'dnf repoquery --latest-limit 1 -d 0' if ansible_pkg_mgr == 'dnf' else 'repoquery' }}" - when: not openshift.common.is_containerized | bool - name: Check latest available OpenShift RPM version command: > -- cgit v1.2.3 From 82f4e4eaeaaf3059013e9ea23d87dcf89fd8455e Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Tue, 21 Jun 2016 15:01:01 -0300 Subject: Refactor 3.2 upgrade to avoid killing nodes without evac. We now handle the two pieces of upgrade that require a node evac in the same play. (docker, and node itself) --- .../openshift-cluster/upgrades/docker/upgrade.yml | 52 ++++++++++++++++ .../upgrades/docker/upgrade_check.yml | 37 +++++++++++ .../upgrades/files/nuke_images.sh | 23 +++++++ .../v3_1_to_v3_2/containerized_node_upgrade.yml | 11 ++++ .../v3_1_to_v3_2/containerized_upgrade.yml | 11 ---- .../upgrades/v3_1_to_v3_2/docker_upgrade.yml | 14 ----- .../upgrades/v3_1_to_v3_2/node_upgrade.yml | 24 -------- .../upgrades/v3_1_to_v3_2/pre.yml | 2 +- .../upgrades/v3_1_to_v3_2/upgrade.yml | 72 +++++++++++----------- 9 files changed, 161 insertions(+), 85 deletions(-) create mode 100644 playbooks/common/openshift-cluster/upgrades/docker/upgrade.yml create mode 100644 playbooks/common/openshift-cluster/upgrades/docker/upgrade_check.yml create mode 100644 playbooks/common/openshift-cluster/upgrades/files/nuke_images.sh create mode 100644 playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/containerized_node_upgrade.yml delete mode 100644 playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/containerized_upgrade.yml delete mode 100644 playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/docker_upgrade.yml delete mode 100644 playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/node_upgrade.yml (limited to 'playbooks/common') diff --git a/playbooks/common/openshift-cluster/upgrades/docker/upgrade.yml b/playbooks/common/openshift-cluster/upgrades/docker/upgrade.yml new file mode 100644 index 000000000..78b123881 --- /dev/null +++ b/playbooks/common/openshift-cluster/upgrades/docker/upgrade.yml @@ -0,0 +1,52 @@ +--- +# We need docker service up to remove all the images, but these services will keep +# trying to re-start and thus re-pull the images we're trying to delete. +- name: stop containerized services + service: name={{ item }} state=stopped + with_items: + - "{{ openshift.common.service_type }}-master" + - "{{ openshift.common.service_type }}-master-api" + - "{{ openshift.common.service_type }}-master-controllers" + - "{{ openshift.common.service_type }}-node" + - etcd_container + - openvswitch + failed_when: false + when: docker_upgrade is defined and docker_upgrade | bool and openshift.common.is_containerized | bool + +- name: remove all containers and images + script: nuke_images.sh docker + register: nuke_images_result + when: docker_upgrade is defined and docker_upgrade | bool + +# todo: should we use the docker role to actually do the upgrade? +- name: upgrade to specified docker version + action: "{{ ansible_pkg_mgr }} name=docker{{ '-' + docker_version }} state=present" + register: docker_upgrade_result + when: docker_upgrade is defined and docker_upgrade | bool and docker_version is defined + +- name: upgrade to latest docker version + action: "{{ ansible_pkg_mgr }} name=docker state=latest" + register: docker_upgrade_result + when: docker_upgrade is defined and docker_upgrade | bool and docker_version is not defined + +- name: restart containerized services + service: name={{ item }} state=started + with_items: + - etcd_container + - openvswitch + - "{{ openshift.common.service_type }}-master" + - "{{ openshift.common.service_type }}-master-api" + - "{{ openshift.common.service_type }}-master-controllers" + - "{{ openshift.common.service_type }}-node" + failed_when: false + when: docker_upgrade is defined and docker_upgrade | bool and openshift.common.is_containerized | bool + +- name: wait for master api to come back online + become: no + local_action: + module: wait_for + host="{{ inventory_hostname }}" + state=started + delay=10 + port="{{ openshift.master.api_port }}" + when: docker_upgrade is defined and docker_upgrade | bool and inventory_hostname in groups.oo_masters_to_config diff --git a/playbooks/common/openshift-cluster/upgrades/docker/upgrade_check.yml b/playbooks/common/openshift-cluster/upgrades/docker/upgrade_check.yml new file mode 100644 index 000000000..928913ef3 --- /dev/null +++ b/playbooks/common/openshift-cluster/upgrades/docker/upgrade_check.yml @@ -0,0 +1,37 @@ +--- +- name: Determine available Docker version + script: ../../../../common/openshift-cluster/upgrades/files/rpm_versions.sh docker + register: g_docker_version_result + +- name: Check if Docker is installed + command: rpm -q docker + register: pkg_check + failed_when: pkg_check.rc > 1 + changed_when: no + +- name: Get current version of Docker + command: "{{ repoquery_cmd }} --installed --qf '%{version}' docker" + register: curr_docker_version + changed_when: false + +- name: Get latest available version of Docker + command: > + {{ repoquery_cmd }} --qf '%{version}' "docker" + register: avail_docker_version + failed_when: false + changed_when: false + +- fail: + msg: This playbook requires access to Docker 1.10 or later + # Disable the 1.10 requirement if the user set a specific Docker version + when: avail_docker_version.stdout | version_compare('1.10','<') and docker_version is not defined + +- name: Flag for upgrade if Docker version does not equal latest + set_fact: + docker_upgrade: true + when: docker_version is not defined and pkg_check.rc == 0 and curr_docker_version.stdout | version_compare(avail_docker_version.stdout,'<') + +- name: Flag for upgrade if Docker version does not equal requested version + set_fact: + docker_upgrade: true + when: docker_version is defined and pkg_check.rc == 0 and curr_docker_version.stdout | version_compare(docker_version,'<') diff --git a/playbooks/common/openshift-cluster/upgrades/files/nuke_images.sh b/playbooks/common/openshift-cluster/upgrades/files/nuke_images.sh new file mode 100644 index 000000000..9a5ee2276 --- /dev/null +++ b/playbooks/common/openshift-cluster/upgrades/files/nuke_images.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +# Stop any running containers +running_container_count=`docker ps -q | wc -l` +if test $running_container_count -gt 0 +then + docker stop $(docker ps -q) +fi + +# Delete all containers +container_count=`docker ps -a -q | wc -l` +if test $container_count -gt 0 +then + docker rm -f -v $(docker ps -a -q) +fi + +# Delete all images (forcefully) +image_count=`docker images -q | wc -l` +if test $image_count -gt 0 +then + # Taken from: https://gist.github.com/brianclements/f72b2de8e307c7b56689#gistcomment-1443144 + docker rmi $(docker images | grep "$2/\|/$2 \| $2 \|$2 \|$2-\|$2_" | awk '{print $1 ":" $2}') 2>/dev/null || echo "No images matching \"$2\" left to purge." +fi diff --git a/playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/containerized_node_upgrade.yml b/playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/containerized_node_upgrade.yml new file mode 100644 index 000000000..319758a06 --- /dev/null +++ b/playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/containerized_node_upgrade.yml @@ -0,0 +1,11 @@ +- include_vars: ../../../../../roles/openshift_node/vars/main.yml + +- name: Update systemd units + include: ../../../../../roles/openshift_node/tasks/systemd_units.yml openshift_version=v{{ g_new_version }} + +- name: Verifying the correct version was configured + shell: grep {{ verify_upgrade_version }} {{ item }} + with_items: + - /etc/sysconfig/openvswitch + - /etc/sysconfig/{{ openshift.common.service_type }}* + when: verify_upgrade_version is defined diff --git a/playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/containerized_upgrade.yml b/playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/containerized_upgrade.yml deleted file mode 100644 index 319758a06..000000000 --- a/playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/containerized_upgrade.yml +++ /dev/null @@ -1,11 +0,0 @@ -- include_vars: ../../../../../roles/openshift_node/vars/main.yml - -- name: Update systemd units - include: ../../../../../roles/openshift_node/tasks/systemd_units.yml openshift_version=v{{ g_new_version }} - -- name: Verifying the correct version was configured - shell: grep {{ verify_upgrade_version }} {{ item }} - with_items: - - /etc/sysconfig/openvswitch - - /etc/sysconfig/{{ openshift.common.service_type }}* - when: verify_upgrade_version is defined diff --git a/playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/docker_upgrade.yml b/playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/docker_upgrade.yml deleted file mode 100644 index c7b18f51b..000000000 --- a/playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/docker_upgrade.yml +++ /dev/null @@ -1,14 +0,0 @@ -- name: Check if Docker is installed - command: rpm -q docker - register: pkg_check - failed_when: pkg_check.rc > 1 - changed_when: no - -- name: Upgrade Docker - command: "{{ ansible_pkg_mgr}} update -y docker" - when: pkg_check.rc == 0 and g_docker_version.curr_version | version_compare('1.9','<') - register: docker_upgrade - -- name: Restart Docker - command: systemctl restart docker - when: docker_upgrade | changed diff --git a/playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/node_upgrade.yml b/playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/node_upgrade.yml deleted file mode 100644 index a911f12be..000000000 --- a/playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/node_upgrade.yml +++ /dev/null @@ -1,24 +0,0 @@ -- name: Prepare for Node evacuation - command: > - {{ openshift.common.admin_binary }} manage-node {{ openshift.common.hostname | lower }} --schedulable=false - delegate_to: "{{ groups.oo_first_master.0 }}" - -- name: Evacuate Node for Kubelet upgrade - command: > - {{ openshift.common.admin_binary }} manage-node {{ openshift.common.hostname | lower }} --evacuate --force - delegate_to: "{{ groups.oo_first_master.0 }}" - -- include: rpm_upgrade.yml - vars: - component: "node" - openshift_version: "{{ openshift_pkg_version | default('') }}" - when: not openshift.common.is_containerized | bool - -- include: containerized_upgrade.yml - when: openshift.common.is_containerized | bool - -- name: Set node schedulability - command: > - {{ openshift.common.admin_binary }} manage-node {{ openshift.common.hostname | lower }} --schedulable=true - delegate_to: "{{ groups.oo_first_master.0 }}" - when: openshift.node.schedulable | bool 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 ec07f0a60..55ede13f0 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 @@ -3,7 +3,7 @@ # Evaluate host groups and gather facts ############################################################################### -- include: ../../common/openshift-cluster/initialize_facts.yml +- include: ../../initialize_facts.yml - name: Update repos hosts: oo_masters_to_config:oo_nodes_to_config:oo_etcd_to_config:oo_lb_to_config diff --git a/playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/upgrade.yml b/playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/upgrade.yml index 66f6f8e71..8eeb652a7 100644 --- a/playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/upgrade.yml +++ b/playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/upgrade.yml @@ -3,19 +3,6 @@ # The restart playbook should be run after this playbook completes. ############################################################################### -- name: Upgrade docker - hosts: oo_masters_to_config:oo_nodes_to_config:oo_etcd_to_config - roles: - - openshift_facts - tasks: - - include: docker_upgrade.yml - when: not openshift.common.is_atomic | bool - - name: Set post docker install facts - openshift_facts: - role: "{{ item.role }}" - with_items: - - role: docker - ############################################################################### # Upgrade Masters ############################################################################### @@ -68,36 +55,51 @@ ############################################################################### # Upgrade Nodes ############################################################################### -- name: Upgrade nodes - hosts: oo_nodes_to_config + +# Here we handle all tasks that might require a node evac. (upgrading docker, and the node service) +- name: Perform upgrades that may require node evacuation + hosts: oo_masters_to_config:oo_etcd_to_config:oo_nodes_to_config serial: 1 + any_errors_fatal: true roles: - openshift_facts handlers: - include: ../../../../../roles/openshift_node/handlers/main.yml tasks: - - include: node_upgrade.yml + # TODO: To better handle re-trying failed upgrades, it would be nice to check if the node + # or docker actually needs an upgrade before proceeding. + - name: Mark unschedulable if host is a node + command: > + {{ openshift.common.admin_binary }} manage-node {{ openshift.common.hostname | lower }} --schedulable=false + delegate_to: "{{ groups.oo_first_master.0 }}" + when: inventory_hostname in groups.oo_nodes_to_config - - set_fact: - node_update_complete: True + - name: Evacuate Node for Kubelet upgrade + command: > + {{ openshift.common.admin_binary }} manage-node {{ openshift.common.hostname | lower }} --evacuate --force + delegate_to: "{{ groups.oo_first_master.0 }}" + when: inventory_hostname in groups.oo_nodes_to_config + + - include: ../docker/upgrade_check.yml + + - include: ../docker/upgrade.yml + when: docker_upgrade is defined and docker_upgrade | bool + + - include: rpm_upgrade.yml + vars: + component: "node" + openshift_version: "{{ openshift_pkg_version | default('') }}" + when: inventory_hostname in groups.oo_nodes_to_config and not openshift.common.is_containerized | bool + + - include: containerized_node_upgrade.yml + when: inventory_hostname in groups.oo_nodes_to_config and openshift.common.is_containerized | bool + + - name: Set node schedulability + command: > + {{ openshift.common.admin_binary }} manage-node {{ openshift.common.hostname | lower }} --schedulable=true + delegate_to: "{{ groups.oo_first_master.0 }}" + when: inventory_hostname in groups.oo_nodes_to_config and openshift.node.schedulable | bool -############################################################################## -# Gate on nodes update -############################################################################## -- name: Gate on nodes update - hosts: localhost - connection: local - become: no - tasks: - - set_fact: - node_update_completed: "{{ hostvars - | oo_select_keys(groups.oo_nodes_to_config) - | oo_collect('inventory_hostname', {'node_update_complete': true}) }}" - - set_fact: - node_update_failed: "{{ groups.oo_nodes_to_config | difference(node_update_completed) }}" - - fail: - msg: "Upgrade cannot continue. The following nodes did not finish updating: {{ node_update_failed | join(',') }}" - when: node_update_failed | length > 0 ############################################################################### # Reconcile Cluster Roles, Cluster Role Bindings and Security Context Constraints -- cgit v1.2.3 From fb2f9f9d2be747a631e9ab13cb7c7898987d509d Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Fri, 24 Jun 2016 10:59:11 -0300 Subject: Allow skipping Docker upgrade during OpenShift upgrade. --- .../openshift-cluster/upgrades/docker/upgrade_check.yml | 13 +++++++++++++ .../openshift-cluster/upgrades/v3_1_to_v3_2/upgrade.yml | 3 +++ 2 files changed, 16 insertions(+) (limited to 'playbooks/common') diff --git a/playbooks/common/openshift-cluster/upgrades/docker/upgrade_check.yml b/playbooks/common/openshift-cluster/upgrades/docker/upgrade_check.yml index 928913ef3..caf8d1de5 100644 --- a/playbooks/common/openshift-cluster/upgrades/docker/upgrade_check.yml +++ b/playbooks/common/openshift-cluster/upgrades/docker/upgrade_check.yml @@ -1,4 +1,10 @@ --- + +# This snippet determines if docker_upgrade should be set for the host. If it's already +# set via the inventory we will respect it. Otherwise we check if the current version +# is equal to the either the latest, or the requested docker_version, and set +# docker_upgrade accordingly. + - name: Determine available Docker version script: ../../../../common/openshift-cluster/upgrades/files/rpm_versions.sh docker register: g_docker_version_result @@ -26,6 +32,13 @@ # Disable the 1.10 requirement if the user set a specific Docker version when: avail_docker_version.stdout | version_compare('1.10','<') and docker_version is not defined +# We respect docker_upgrade=False in the inventory, but True is the default and +# if set in inventory, we still flip it to False here and only set to true if +# they're not already running the required version. +- set_fact: + docker_upgrade: False + when: docker_upgrade is not defined or docker_upgrade | bool + - name: Flag for upgrade if Docker version does not equal latest set_fact: docker_upgrade: true diff --git a/playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/upgrade.yml b/playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/upgrade.yml index 8eeb652a7..f2e408ad4 100644 --- a/playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/upgrade.yml +++ b/playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/upgrade.yml @@ -80,7 +80,10 @@ delegate_to: "{{ groups.oo_first_master.0 }}" when: inventory_hostname in groups.oo_nodes_to_config + # Only check if docker upgrade is required if docker_upgrade is not + # already set to False. - include: ../docker/upgrade_check.yml + when: docker_upgrade is not defined or docker_upgrade | bool - include: ../docker/upgrade.yml when: docker_upgrade is defined and docker_upgrade | bool -- cgit v1.2.3 From 9a5bd6ab7b46228b62f8d8d29dd1f0574c3ec3fa Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Fri, 24 Jun 2016 17:04:43 -0300 Subject: Fix node/openvswitch containers not restarting after upgrade. --- .../upgrades/v3_1_to_v3_2/containerized_node_upgrade.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'playbooks/common') diff --git a/playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/containerized_node_upgrade.yml b/playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/containerized_node_upgrade.yml index 319758a06..60ea84f8e 100644 --- a/playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/containerized_node_upgrade.yml +++ b/playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/containerized_node_upgrade.yml @@ -1,7 +1,7 @@ - include_vars: ../../../../../roles/openshift_node/vars/main.yml - name: Update systemd units - include: ../../../../../roles/openshift_node/tasks/systemd_units.yml openshift_version=v{{ g_new_version }} + include: ../../../../../roles/openshift_node/tasks/systemd_units.yml openshift_version={{ openshift_image_tag }} - name: Verifying the correct version was configured shell: grep {{ verify_upgrade_version }} {{ item }} -- cgit v1.2.3 From 08f1caed84d46d0263f0c1aaaf2da891946b1a96 Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Mon, 27 Jun 2016 11:15:40 -0300 Subject: Only nuke images when crossing the Docker 1.10 boundary in upgrade. --- .../openshift-cluster/upgrades/docker/upgrade.yml | 27 ++++++++-------------- .../upgrades/docker/upgrade_check.yml | 17 +++++++++----- .../upgrades/v3_1_to_v3_2/pre.yml | 4 ++++ .../upgrades/v3_1_to_v3_2/upgrade.yml | 2 +- 4 files changed, 26 insertions(+), 24 deletions(-) (limited to 'playbooks/common') diff --git a/playbooks/common/openshift-cluster/upgrades/docker/upgrade.yml b/playbooks/common/openshift-cluster/upgrades/docker/upgrade.yml index 78b123881..81db9ef20 100644 --- a/playbooks/common/openshift-cluster/upgrades/docker/upgrade.yml +++ b/playbooks/common/openshift-cluster/upgrades/docker/upgrade.yml @@ -1,7 +1,7 @@ --- # We need docker service up to remove all the images, but these services will keep # trying to re-start and thus re-pull the images we're trying to delete. -- name: stop containerized services +- name: Stop containerized services service: name={{ item }} state=stopped with_items: - "{{ openshift.common.service_type }}-master" @@ -11,25 +11,18 @@ - etcd_container - openvswitch failed_when: false - when: docker_upgrade is defined and docker_upgrade | bool and openshift.common.is_containerized | bool + when: docker_upgrade | bool and openshift.common.is_containerized | bool -- name: remove all containers and images +- name: Remove all containers and images script: nuke_images.sh docker register: nuke_images_result - when: docker_upgrade is defined and docker_upgrade | bool + when: docker_upgrade | bool and docker_upgrade_nuke_images is defined and docker_upgrade_nuke_images | bool -# todo: should we use the docker role to actually do the upgrade? -- name: upgrade to specified docker version +- name: Upgrade Docker action: "{{ ansible_pkg_mgr }} name=docker{{ '-' + docker_version }} state=present" - register: docker_upgrade_result - when: docker_upgrade is defined and docker_upgrade | bool and docker_version is defined + when: docker_upgrade | bool -- name: upgrade to latest docker version - action: "{{ ansible_pkg_mgr }} name=docker state=latest" - register: docker_upgrade_result - when: docker_upgrade is defined and docker_upgrade | bool and docker_version is not defined - -- name: restart containerized services +- name: Restart containerized services service: name={{ item }} state=started with_items: - etcd_container @@ -39,9 +32,9 @@ - "{{ openshift.common.service_type }}-master-controllers" - "{{ openshift.common.service_type }}-node" failed_when: false - when: docker_upgrade is defined and docker_upgrade | bool and openshift.common.is_containerized | bool + when: docker_upgrade | bool and openshift.common.is_containerized | bool -- name: wait for master api to come back online +- name: Wait for master API to come back online become: no local_action: module: wait_for @@ -49,4 +42,4 @@ state=started delay=10 port="{{ openshift.master.api_port }}" - when: docker_upgrade is defined and docker_upgrade | bool and inventory_hostname in groups.oo_masters_to_config + when: docker_upgrade | bool and inventory_hostname in groups.oo_masters_to_config diff --git a/playbooks/common/openshift-cluster/upgrades/docker/upgrade_check.yml b/playbooks/common/openshift-cluster/upgrades/docker/upgrade_check.yml index caf8d1de5..7fd4657d5 100644 --- a/playbooks/common/openshift-cluster/upgrades/docker/upgrade_check.yml +++ b/playbooks/common/openshift-cluster/upgrades/docker/upgrade_check.yml @@ -39,12 +39,17 @@ docker_upgrade: False when: docker_upgrade is not defined or docker_upgrade | bool -- name: Flag for upgrade if Docker version does not equal latest - set_fact: - docker_upgrade: true - when: docker_version is not defined and pkg_check.rc == 0 and curr_docker_version.stdout | version_compare(avail_docker_version.stdout,'<') +# Make sure a docker_verison is set if none was requested: +- set_fact: + docker_version: avail_docker_version.stdout + when: docker_version is not defined -- name: Flag for upgrade if Docker version does not equal requested version +- name: Flag for Docker upgrade if necessary set_fact: - docker_upgrade: true + docker_upgrade: True when: docker_version is defined and pkg_check.rc == 0 and curr_docker_version.stdout | version_compare(docker_version,'<') + +- name: Flag to delete all images prior to upgrade if crossing Docker 1.10 boundary + set_fact: + docker_upgrade_nuke_images: True + when: docker_upgrade_nuke_images is not defined and docker_upgrade | bool and curr_docker_version.stdout | version_compare('1.10','<') and docker_version | version_compare('1.10','>=') 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 55ede13f0..e78418c6c 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 @@ -89,6 +89,10 @@ # defined, and overriding the normal behavior of protecting the installed version openshift_release: "3.2" openshift_protect_installed_version: False + # Docker role (a dependency) should be told not to do anything to installed version + # of docker, we handle this separately during upgrade. (the inventory may have a + # docker_version defined, we don't want to actually do it until later) + docker_protect_installed_version: True - name: Verify master processes hosts: oo_masters_to_config diff --git a/playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/upgrade.yml b/playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/upgrade.yml index f2e408ad4..bea1eb4e1 100644 --- a/playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/upgrade.yml +++ b/playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/upgrade.yml @@ -86,7 +86,7 @@ when: docker_upgrade is not defined or docker_upgrade | bool - include: ../docker/upgrade.yml - when: docker_upgrade is defined and docker_upgrade | bool + when: docker_upgrade | bool - include: rpm_upgrade.yml vars: -- cgit v1.2.3 From f004b526078b78b0ba9435b82af4d4f4d42de5e2 Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Mon, 27 Jun 2016 15:44:04 -0300 Subject: More docker upgrade fixes. --- .../openshift-cluster/upgrades/docker/upgrade.yml | 9 ++++--- .../upgrades/docker/upgrade_check.yml | 28 ++++++++++------------ .../upgrades/v3_1_to_v3_2/upgrade.yml | 2 +- 3 files changed, 17 insertions(+), 22 deletions(-) (limited to 'playbooks/common') diff --git a/playbooks/common/openshift-cluster/upgrades/docker/upgrade.yml b/playbooks/common/openshift-cluster/upgrades/docker/upgrade.yml index 81db9ef20..20d66522f 100644 --- a/playbooks/common/openshift-cluster/upgrades/docker/upgrade.yml +++ b/playbooks/common/openshift-cluster/upgrades/docker/upgrade.yml @@ -11,16 +11,15 @@ - etcd_container - openvswitch failed_when: false - when: docker_upgrade | bool and openshift.common.is_containerized | bool + when: openshift.common.is_containerized | bool - name: Remove all containers and images script: nuke_images.sh docker register: nuke_images_result - when: docker_upgrade | bool and docker_upgrade_nuke_images is defined and docker_upgrade_nuke_images | bool + when: docker_upgrade_nuke_images is defined and docker_upgrade_nuke_images | bool - name: Upgrade Docker action: "{{ ansible_pkg_mgr }} name=docker{{ '-' + docker_version }} state=present" - when: docker_upgrade | bool - name: Restart containerized services service: name={{ item }} state=started @@ -32,7 +31,7 @@ - "{{ openshift.common.service_type }}-master-controllers" - "{{ openshift.common.service_type }}-node" failed_when: false - when: docker_upgrade | bool and openshift.common.is_containerized | bool + when: openshift.common.is_containerized | bool - name: Wait for master API to come back online become: no @@ -42,4 +41,4 @@ state=started delay=10 port="{{ openshift.master.api_port }}" - when: docker_upgrade | bool and inventory_hostname in groups.oo_masters_to_config + when: inventory_hostname in groups.oo_masters_to_config diff --git a/playbooks/common/openshift-cluster/upgrades/docker/upgrade_check.yml b/playbooks/common/openshift-cluster/upgrades/docker/upgrade_check.yml index 7fd4657d5..0a70ab723 100644 --- a/playbooks/common/openshift-cluster/upgrades/docker/upgrade_check.yml +++ b/playbooks/common/openshift-cluster/upgrades/docker/upgrade_check.yml @@ -1,13 +1,11 @@ --- -# This snippet determines if docker_upgrade should be set for the host. If it's already -# set via the inventory we will respect it. Otherwise we check if the current version -# is equal to the either the latest, or the requested docker_version, and set -# docker_upgrade accordingly. +# This snippet determines if a Docker upgrade is required by checking the inventory +# variables, the available packages, and sets l_docker_version to True if so. -- name: Determine available Docker version - script: ../../../../common/openshift-cluster/upgrades/files/rpm_versions.sh docker - register: g_docker_version_result +- set_fact: + docker_upgrade: True + when: docker_upgrade is not defined - name: Check if Docker is installed command: rpm -q docker @@ -32,24 +30,22 @@ # Disable the 1.10 requirement if the user set a specific Docker version when: avail_docker_version.stdout | version_compare('1.10','<') and docker_version is not defined -# We respect docker_upgrade=False in the inventory, but True is the default and -# if set in inventory, we still flip it to False here and only set to true if -# they're not already running the required version. +# Default l_docker_upgrade to False, we'll set to True if an upgrade is required: - set_fact: - docker_upgrade: False - when: docker_upgrade is not defined or docker_upgrade | bool + l_docker_upgrade: False # Make sure a docker_verison is set if none was requested: - set_fact: - docker_version: avail_docker_version.stdout + docker_version: "{{ avail_docker_version.stdout }}" when: docker_version is not defined - name: Flag for Docker upgrade if necessary set_fact: - docker_upgrade: True - when: docker_version is defined and pkg_check.rc == 0 and curr_docker_version.stdout | version_compare(docker_version,'<') + l_docker_upgrade: True + when: pkg_check.rc == 0 and curr_docker_version.stdout | version_compare(docker_version,'<') - name: Flag to delete all images prior to upgrade if crossing Docker 1.10 boundary set_fact: docker_upgrade_nuke_images: True - when: docker_upgrade_nuke_images is not defined and docker_upgrade | bool and curr_docker_version.stdout | version_compare('1.10','<') and docker_version | version_compare('1.10','>=') + when: docker_upgrade_nuke_images is not defined and curr_docker_version.stdout | version_compare('1.10','<') and docker_version | version_compare('1.10','>=') + diff --git a/playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/upgrade.yml b/playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/upgrade.yml index bea1eb4e1..6c27b0d44 100644 --- a/playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/upgrade.yml +++ b/playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/upgrade.yml @@ -86,7 +86,7 @@ when: docker_upgrade is not defined or docker_upgrade | bool - include: ../docker/upgrade.yml - when: docker_upgrade | bool + when: l_docker_upgrade is defined and l_docker_upgrade | bool - include: rpm_upgrade.yml vars: -- cgit v1.2.3 From 6c746ab59b9c02a9e416dd2ccb9552f1d9112fcb Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Tue, 28 Jun 2016 10:56:12 -0300 Subject: Fixes for non-containerized separate etcd hosts. --- playbooks/common/openshift-cluster/initialize_facts.yml | 3 +++ playbooks/common/openshift-cluster/upgrades/docker/upgrade_check.yml | 2 +- playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/pre.yml | 5 +---- 3 files changed, 5 insertions(+), 5 deletions(-) (limited to 'playbooks/common') diff --git a/playbooks/common/openshift-cluster/initialize_facts.yml b/playbooks/common/openshift-cluster/initialize_facts.yml index a4af5efc5..b44102abc 100644 --- a/playbooks/common/openshift-cluster/initialize_facts.yml +++ b/playbooks/common/openshift-cluster/initialize_facts.yml @@ -10,3 +10,6 @@ hostname: "{{ openshift_hostname | default(None) }}" - set_fact: openshift_docker_hosted_registry_network: "{{ hostvars[groups.oo_first_master.0].openshift.common.portal_net }}" + - set_fact: + repoquery_cmd: "{{ 'dnf repoquery --latest-limit 1 -d 0' if ansible_pkg_mgr == 'dnf' else 'repoquery' }}" + diff --git a/playbooks/common/openshift-cluster/upgrades/docker/upgrade_check.yml b/playbooks/common/openshift-cluster/upgrades/docker/upgrade_check.yml index 0a70ab723..06b3e244f 100644 --- a/playbooks/common/openshift-cluster/upgrades/docker/upgrade_check.yml +++ b/playbooks/common/openshift-cluster/upgrades/docker/upgrade_check.yml @@ -47,5 +47,5 @@ - name: Flag to delete all images prior to upgrade if crossing Docker 1.10 boundary set_fact: docker_upgrade_nuke_images: True - when: docker_upgrade_nuke_images is not defined and curr_docker_version.stdout | version_compare('1.10','<') and docker_version | version_compare('1.10','>=') + when: l_docker_upgrade | bool and docker_upgrade_nuke_images is not defined and curr_docker_version.stdout | version_compare('1.10','<') and docker_version | version_compare('1.10','>=') 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 11e77c3de..b49b3df7d 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 @@ -5,7 +5,7 @@ - include: ../../initialize_facts.yml -- name: Update repos +- name: Update repos and initialize facts on all hosts hosts: oo_masters_to_config:oo_nodes_to_config:oo_etcd_to_config:oo_lb_to_config roles: - openshift_repos @@ -165,9 +165,6 @@ docker pull {{ openshift.common.cli_image }}:{{ openshift_image_tag }} when: openshift.common.is_containerized | bool - - set_fact: - repoquery_cmd: "{{ 'dnf repoquery --latest-limit 1 -d 0' if ansible_pkg_mgr == 'dnf' else 'repoquery' }}" - - name: Check latest available OpenShift RPM version command: > {{ repoquery_cmd }} --qf '%{version}' "{{ openshift.common.service_type }}" -- cgit v1.2.3 From 0f5b273c977af59ee2fdbb63efe8b8a3722c988c Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Mon, 4 Jul 2016 10:35:50 -0300 Subject: Update repoquery_cmd definitions to match latest in master. --- playbooks/common/openshift-cluster/initialize_facts.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'playbooks/common') diff --git a/playbooks/common/openshift-cluster/initialize_facts.yml b/playbooks/common/openshift-cluster/initialize_facts.yml index 4cade9c61..d6759cb13 100644 --- a/playbooks/common/openshift-cluster/initialize_facts.yml +++ b/playbooks/common/openshift-cluster/initialize_facts.yml @@ -12,5 +12,5 @@ - set_fact: openshift_docker_hosted_registry_network: "{{ hostvars[groups.oo_first_master.0].openshift.common.portal_net }}" - set_fact: - repoquery_cmd: "{{ 'dnf repoquery --latest-limit 1 -d 0' if ansible_pkg_mgr == 'dnf' else 'repoquery' }}" + repoquery_cmd: "{{ 'dnf repoquery --latest-limit 1 -d 0' if ansible_pkg_mgr == 'dnf' else 'repoquery --plugins' }}" -- cgit v1.2.3 From 76829048f7b529f0932bb99d96a774244329291a Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Mon, 4 Jul 2016 14:32:25 -0300 Subject: Add symlinks for node templates. This is an unfortunate side effect of including a role yaml file in a playbook, ideally we would just run the full node role here. For now we'll follow the lead for the master template. --- .../upgrades/v3_1_to_v3_2/openshift.docker.node.dep.service | 1 + .../upgrades/v3_1_to_v3_2/openshift.docker.node.service | 1 + .../openshift-cluster/upgrades/v3_1_to_v3_2/openvswitch.docker.service | 1 + .../openshift-cluster/upgrades/v3_1_to_v3_2/openvswitch.sysconfig.j2 | 1 + 4 files changed, 4 insertions(+) create mode 120000 playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/openshift.docker.node.dep.service create mode 120000 playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/openshift.docker.node.service create mode 120000 playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/openvswitch.docker.service create mode 120000 playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/openvswitch.sysconfig.j2 (limited to 'playbooks/common') diff --git a/playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/openshift.docker.node.dep.service b/playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/openshift.docker.node.dep.service new file mode 120000 index 000000000..b384a3f4d --- /dev/null +++ b/playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/openshift.docker.node.dep.service @@ -0,0 +1 @@ +../../../../../roles/openshift_node/templates/openshift.docker.node.dep.service \ No newline at end of file diff --git a/playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/openshift.docker.node.service b/playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/openshift.docker.node.service new file mode 120000 index 000000000..a2f140144 --- /dev/null +++ b/playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/openshift.docker.node.service @@ -0,0 +1 @@ +../../../../../roles/openshift_node/templates/openshift.docker.node.service \ No newline at end of file diff --git a/playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/openvswitch.docker.service b/playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/openvswitch.docker.service new file mode 120000 index 000000000..61946ff91 --- /dev/null +++ b/playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/openvswitch.docker.service @@ -0,0 +1 @@ +../../../../../roles/openshift_node/templates/openvswitch.docker.service \ No newline at end of file diff --git a/playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/openvswitch.sysconfig.j2 b/playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/openvswitch.sysconfig.j2 new file mode 120000 index 000000000..3adc56e4e --- /dev/null +++ b/playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/openvswitch.sysconfig.j2 @@ -0,0 +1 @@ +../../../../../roles/openshift_node/templates/openvswitch.sysconfig.j2 \ No newline at end of file -- cgit v1.2.3 From c1728c8847177988e4532b9c9c777e1a23223410 Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Thu, 7 Jul 2016 12:28:28 -0300 Subject: Move repoquery fact definition to openshift_common. --- playbooks/common/openshift-cluster/initialize_facts.yml | 3 --- 1 file changed, 3 deletions(-) (limited to 'playbooks/common') diff --git a/playbooks/common/openshift-cluster/initialize_facts.yml b/playbooks/common/openshift-cluster/initialize_facts.yml index d6759cb13..04dde632b 100644 --- a/playbooks/common/openshift-cluster/initialize_facts.yml +++ b/playbooks/common/openshift-cluster/initialize_facts.yml @@ -11,6 +11,3 @@ hostname: "{{ openshift_hostname | default(None) }}" - set_fact: openshift_docker_hosted_registry_network: "{{ hostvars[groups.oo_first_master.0].openshift.common.portal_net }}" - - set_fact: - repoquery_cmd: "{{ 'dnf repoquery --latest-limit 1 -d 0' if ansible_pkg_mgr == 'dnf' else 'repoquery --plugins' }}" - -- 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 ------------- .../common/openshift-cluster/upgrades/v3_1_to_v3_2/pre.yml | 2 -- 2 files changed, 15 deletions(-) (limited to 'playbooks/common') 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 - 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 b49b3df7d..7a8dfdf91 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 @@ -173,8 +173,6 @@ register: avail_openshift_version when: not openshift.common.is_containerized | bool - - debug: var=avail_openshift_version - - name: Verify OpenShift 3.2 RPMs are available for upgrade fail: msg: "OpenShift {{ avail_openshift_version.stdout }} is available, but 3.2 or greater is required" -- cgit v1.2.3 From 2a8b144073f474bf966c6ab92329442a1a526bde Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Fri, 8 Jul 2016 11:48:12 -0300 Subject: Remove/update TODOs. --- playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/upgrade.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'playbooks/common') diff --git a/playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/upgrade.yml b/playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/upgrade.yml index 6c27b0d44..0ea315d0a 100644 --- a/playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/upgrade.yml +++ b/playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/upgrade.yml @@ -67,7 +67,8 @@ - include: ../../../../../roles/openshift_node/handlers/main.yml tasks: # TODO: To better handle re-trying failed upgrades, it would be nice to check if the node - # or docker actually needs an upgrade before proceeding. + # or docker actually needs an upgrade before proceeding. Perhaps best to save this until + # we merge upgrade functionality into the base roles and a normal config.yml playbook run. - name: Mark unschedulable if host is a node command: > {{ openshift.common.admin_binary }} manage-node {{ openshift.common.hostname | lower }} --schedulable=false -- cgit v1.2.3 From 7ce564ca44ef1b02037a2255244bd8f3057734dc Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Tue, 12 Jul 2016 10:27:39 -0300 Subject: Fix upgrades with an openshift_image_tag set. --- .../common/openshift-cluster/upgrades/v3_1_to_v3_2/rpm_upgrade.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'playbooks/common') diff --git a/playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/rpm_upgrade.yml b/playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/rpm_upgrade.yml index 1d97d3802..f5e4d807e 100644 --- a/playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/rpm_upgrade.yml +++ b/playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/rpm_upgrade.yml @@ -1,6 +1,6 @@ # We verified latest rpm available is suitable, so just yum update. - name: Upgrade packages - command: "{{ ansible_pkg_mgr}} update -y {{ openshift.common.service_type }}-{{ component }}" + action: "{{ ansible_pkg_mgr }} name={{ openshift.common.service_type }}-{{ component }}{{ openshift_pkg_version }} state=present" - name: Ensure python-yaml present for config upgrade action: "{{ ansible_pkg_mgr }} name=PyYAML state=present" -- cgit v1.2.3