forked from openshift/openshift-ansible
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
backport openshift#4321 verify upgrade targets separately for each group
- Loading branch information
1 parent
435770c
commit 0f5bc71
Showing
8 changed files
with
129 additions
and
85 deletions.
There are no files selected for viewing
33 changes: 15 additions & 18 deletions
33
playbooks/common/openshift-cluster/upgrades/pre/verify_docker_upgrade_targets.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,20 @@ | ||
--- | ||
- name: Verify docker upgrade targets | ||
hosts: oo_masters_to_config:oo_nodes_to_upgrade:oo_etcd_to_config | ||
tasks: | ||
# 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 and not openshift.common.is_atomic | bool | ||
# 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 and not openshift.common.is_atomic | bool | ||
|
||
# Additional checks for Atomic hosts: | ||
# Additional checks for Atomic hosts: | ||
|
||
- name: Determine available Docker | ||
shell: "rpm -q --queryformat '---\ncurr_version: %{VERSION}\navail_version: \n' docker" | ||
register: g_atomic_docker_version_result | ||
when: openshift.common.is_atomic | bool | ||
- name: Determine available Docker | ||
shell: "rpm -q --queryformat '---\ncurr_version: %{VERSION}\navail_version: \n' docker" | ||
register: g_atomic_docker_version_result | ||
when: openshift.common.is_atomic | bool | ||
|
||
- set_fact: | ||
l_docker_version: "{{ g_atomic_docker_version_result.stdout | from_yaml }}" | ||
when: openshift.common.is_atomic | bool | ||
- set_fact: | ||
l_docker_version: "{{ g_atomic_docker_version_result.stdout | from_yaml }}" | ||
when: openshift.common.is_atomic | bool | ||
|
||
- fail: | ||
msg: This playbook requires access to Docker 1.12 or later | ||
when: openshift.common.is_atomic | bool and l_docker_version.avail_version | default(l_docker_version.curr_version, true) | version_compare('1.12','<') | ||
- fail: | ||
msg: This playbook requires access to Docker 1.12 or later | ||
when: openshift.common.is_atomic | bool and l_docker_version.avail_version | default(l_docker_version.curr_version, true) | version_compare('1.12','<') |
105 changes: 50 additions & 55 deletions
105
playbooks/common/openshift-cluster/upgrades/pre/verify_upgrade_targets.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,56 +1,51 @@ | ||
--- | ||
- name: Verify upgrade targets | ||
hosts: oo_masters_to_config:oo_nodes_to_upgrade | ||
vars: | ||
openshift_docker_hosted_registry_network: "{{ hostvars[groups.oo_first_master.0].openshift.common.portal_net }}" | ||
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 | ||
|
||
- set_fact: | ||
g_new_service_name: "{{ 'origin' if deployment_type =='origin' else 'atomic-openshift' }}" | ||
when: not openshift.common.is_containerized | bool | ||
|
||
- name: Verify containers are available for upgrade | ||
command: > | ||
docker pull {{ openshift.common.cli_image }}:{{ openshift_image_tag }} | ||
register: pull_result | ||
changed_when: "'Downloaded newer image' in pull_result.stdout" | ||
when: openshift.common.is_containerized | bool | ||
|
||
- block: | ||
- name: Check latest available OpenShift RPM version | ||
repoquery: | ||
name: "{{ openshift.common.service_type }}" | ||
ignore_excluders: true | ||
register: repoquery_out | ||
|
||
- name: Fail when {{ openshift.common.service_type }} package is not found | ||
fail: | ||
msg: "Package {{ openshift.common.service_type }} not found" | ||
when: not repoquery_out.results.package_found | ||
|
||
- name: Set fact avail_openshift_version | ||
set_fact: | ||
avail_openshift_version: "{{ repoquery_out.results.versions.available_versions.0 }}" | ||
|
||
- name: Verify OpenShift RPMs are available for upgrade | ||
fail: | ||
msg: "OpenShift {{ avail_openshift_version }} is available, but {{ openshift_upgrade_target }} or greater is required" | ||
when: | ||
- avail_openshift_version | default('0.0', True) | version_compare(openshift_release, '<') | ||
|
||
when: not openshift.common.is_containerized | bool | ||
|
||
- fail: | ||
msg: "This upgrade playbook must be run against OpenShift {{ openshift_upgrade_min }} or later" | ||
when: deployment_type == 'origin' and openshift.common.version | version_compare(openshift_upgrade_min,'<') | ||
- 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 | ||
|
||
- set_fact: | ||
g_new_service_name: "{{ 'origin' if deployment_type =='origin' else 'atomic-openshift' }}" | ||
when: not openshift.common.is_containerized | bool | ||
|
||
- name: Verify containers are available for upgrade | ||
command: > | ||
docker pull {{ openshift.common.cli_image }}:{{ openshift_image_tag }} | ||
register: pull_result | ||
changed_when: "'Downloaded newer image' in pull_result.stdout" | ||
when: openshift.common.is_containerized | bool | ||
|
||
- block: | ||
- name: Check latest available OpenShift RPM version | ||
repoquery: | ||
name: "{{ openshift.common.service_type }}" | ||
ignore_excluders: true | ||
register: repoquery_out | ||
|
||
- name: Fail when {{ openshift.common.service_type }} package is not found | ||
fail: | ||
msg: "Package {{ openshift.common.service_type }} not found" | ||
when: not repoquery_out.results.package_found | ||
|
||
- name: Set fact avail_openshift_version | ||
set_fact: | ||
avail_openshift_version: "{{ repoquery_out.results.versions.available_versions.0 }}" | ||
|
||
- name: Verify OpenShift RPMs are available for upgrade | ||
fail: | ||
msg: "OpenShift {{ avail_openshift_version }} is available, but {{ openshift_upgrade_target }} or greater is required" | ||
when: | ||
- avail_openshift_version | default('0.0', True) | version_compare(openshift_release, '<') | ||
|
||
when: not openshift.common.is_containerized | bool | ||
|
||
- fail: | ||
msg: "This upgrade playbook must be run against OpenShift {{ openshift_upgrade_min }} or later" | ||
when: deployment_type == 'origin' and openshift.common.version | version_compare(openshift_upgrade_min,'<') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters