summaryrefslogtreecommitdiffstats
path: root/playbooks/common/openshift-cluster/upgrades/pre/verify_inventory_vars.yml
blob: 4c345dbe89c6ea27ff07349774884d89a8a547af (plain)
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
46
47
48
49
50
51
52
---
- name: Verify upgrade can proceed on first master
  hosts: oo_first_master
  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']

  # osm_cluster_network_cidr, osm_host_subnet_length and openshift_portal_net are
  # required when upgrading to avoid changes that may occur between releases
  # Reference: https://bugzilla.redhat.com/show_bug.cgi?id=1451023
  - assert:
      that:
      - "osm_cluster_network_cidr is defined"
      - "osm_host_subnet_length is defined"
      - "openshift_portal_net is defined"
      msg: >
        osm_cluster_network_cidr, osm_host_subnet_length, and openshift_portal_net are required inventory
        variables when upgrading. These variables should match what is currently used in the cluster. If
        you don't remember what these values are you can find them in /etc/origin/master/master-config.yaml
        on a master with the names clusterNetworkCIDR (osm_cluster_network_cidr),
        hostSubnetLength (osm_host_subnet_length), and serviceNetworkCIDR (openshift_portal_net).

  # 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
        valid version for a {{ openshift_upgrade_target }} upgrade
    when: openshift_pkg_version is defined and openshift_pkg_version.split('-',1).1 | version_compare(openshift_upgrade_target ,'<')

  - fail:
      msg: >
        openshift_image_tag is {{ openshift_image_tag }} which is not a
        valid version for a {{ openshift_upgrade_target }} upgrade
    when: openshift_image_tag is defined and openshift_image_tag.split('v',1).1 | version_compare(openshift_upgrade_target ,'<')

  - 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
        valid release for a {{ openshift_upgrade_target }} upgrade
    when: openshift_release is defined and not openshift_release | version_compare(openshift_upgrade_target ,'=')