main.yml 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. ---
  2. - name: Abort when conflicting deployment type variables are set
  3. when:
  4. - deployment_type is defined
  5. - openshift_deployment_type is defined
  6. - openshift_deployment_type != deployment_type
  7. fail:
  8. msg: |-
  9. openshift_deployment_type is set to "{{ openshift_deployment_type }}".
  10. deployment_type is set to "{{ deployment_type }}".
  11. To avoid unexpected results, this conflict is not allowed.
  12. deployment_type is deprecated in favor of openshift_deployment_type.
  13. Please specify only openshift_deployment_type, or make both the same.
  14. # osm_cluster_network_cidr, osm_host_subnet_length and openshift_portal_net are
  15. # now required to avoid changes that may occur between releases
  16. # Reference: https://bugzilla.redhat.com/show_bug.cgi?id=1451023
  17. - assert:
  18. that:
  19. - "osm_cluster_network_cidr is defined"
  20. - "osm_host_subnet_length is defined"
  21. - "openshift_portal_net is defined"
  22. msg: >
  23. osm_cluster_network_cidr, osm_host_subnet_length, and openshift_portal_net are required inventory
  24. variables. If you are upgrading or scaling up these variables should match what is currently used
  25. in the cluster. If you don't remember what these values are you can find them in
  26. /etc/origin/master/master-config.yaml on a master with the names clusterNetworkCIDR
  27. (osm_cluster_network_cidr), hostSubnetLength (osm_host_subnet_length),
  28. and serviceNetworkCIDR (openshift_portal_net).
  29. - name: Standardize on latest variable names
  30. set_fact:
  31. # goal is to deprecate deployment_type in favor of openshift_deployment_type.
  32. # both will be accepted for now, but code should refer to the new name.
  33. # TODO: once this is well-documented, add deprecation notice if using old name.
  34. deployment_type: "{{ openshift_deployment_type | default(deployment_type) | default | string }}"
  35. openshift_deployment_type: "{{ openshift_deployment_type | default(deployment_type) | default | string }}"
  36. - name: Abort when deployment type is invalid
  37. # this variable is required; complain early and clearly if it is invalid.
  38. when: openshift_deployment_type not in known_openshift_deployment_types
  39. fail:
  40. msg: |-
  41. Please set openshift_deployment_type to one of:
  42. {{ known_openshift_deployment_types | join(', ') }}
  43. - name: Normalize openshift_release
  44. set_fact:
  45. # Normalize release if provided, e.g. "v3.5" => "3.5"
  46. # Currently this is not required to be defined for all installs, and the
  47. # `openshift_version` role can generally figure out the specific version
  48. # that gets installed (e.g. 3.5.0.1). So consider this the user's expressed
  49. # intent (if any), not the authoritative version that will be installed.
  50. openshift_release: "{{ openshift_release | string | regex_replace('^v', '') }}"
  51. when: openshift_release is defined
  52. - name: Abort when openshift_release is invalid
  53. when:
  54. - openshift_release is defined
  55. - not openshift_release | match('\d+(\.\d+){1,3}$')
  56. fail:
  57. msg: |-
  58. openshift_release is "{{ openshift_release }}" which is not a valid version string.
  59. Please set it to a version string like "3.4".
  60. - include: unsupported.yml
  61. when:
  62. - not openshift_enable_unsupported_configurations | default(false) | bool