-
Notifications
You must be signed in to change notification settings - Fork 2.3k
/
verify_upgrade_targets.yml
45 lines (38 loc) · 1.94 KB
/
verify_upgrade_targets.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
---
- 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
- name: Check latest available OpenShift RPM version
command: >
{{ 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
- name: Verify OpenShift RPMs are available for upgrade
fail:
msg: "OpenShift {{ avail_openshift_version.stdout }} is available, but {{ openshift_upgrade_target }} 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(openshift_release, '<')
- 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,'<')