summaryrefslogtreecommitdiffstats
path: root/roles/openshift_sanitize_inventory/tasks/main.yml
blob: 89bfc011c4b324f16485cff803119ef1e7b27617 (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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
---
- name: Abort when conflicting deployment type variables are set
  when:
    - deployment_type is defined
    - openshift_deployment_type is defined
    - openshift_deployment_type != deployment_type
  fail:
    msg: |-
      openshift_deployment_type is set to "{{ openshift_deployment_type }}".
      deployment_type is set to "{{ deployment_type }}".
      To avoid unexpected results, this conflict is not allowed.
      deployment_type is deprecated in favor of openshift_deployment_type.
      Please specify only openshift_deployment_type, or make both the same.

# osm_cluster_network_cidr, osm_host_subnet_length and openshift_portal_net are
# now required 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. If you are upgrading or scaling up 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).

- name: Standardize on latest variable names
  set_fact:
    # goal is to deprecate deployment_type in favor of openshift_deployment_type.
    # both will be accepted for now, but code should refer to the new name.
    # TODO: once this is well-documented, add deprecation notice if using old name.
    deployment_type: "{{ openshift_deployment_type | default(deployment_type) | default | string }}"
    openshift_deployment_type: "{{ openshift_deployment_type | default(deployment_type) | default | string }}"

- name: Abort when deployment type is invalid
  # this variable is required; complain early and clearly if it is invalid.
  when: openshift_deployment_type not in known_openshift_deployment_types
  fail:
    msg: |-
      Please set openshift_deployment_type to one of:
      {{ known_openshift_deployment_types | join(', ') }}

- name: Normalize openshift_release
  set_fact:
    # Normalize release if provided, e.g. "v3.5" => "3.5"
    # Currently this is not required to be defined for all installs, and the
    # `openshift_version` role can generally figure out the specific version
    # that gets installed (e.g. 3.5.0.1). So consider this the user's expressed
    # intent (if any), not the authoritative version that will be installed.
    openshift_release: "{{ openshift_release | string | regex_replace('^v', '') }}"
  when: openshift_release is defined

- name: Abort when openshift_release is invalid
  when:
    - openshift_release is defined
    - not openshift_release | match('\d+(\.\d+){1,3}$')
  fail:
    msg: |-
      openshift_release is "{{ openshift_release }}" which is not a valid version string.
      Please set it to a version string like "3.4".

- include: unsupported.yml
  when:
    - not openshift_enable_unsupported_configurations | default(false) | bool