main.yml 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. ---
  2. # We should print out deprecations prior to any failures so that if a play does fail for other reasons
  3. # the user would also be aware of any deprecated variables they should note to adjust
  4. - include: deprecations.yml
  5. - name: Abort when conflicting deployment type variables are set
  6. when:
  7. - deployment_type is defined
  8. - openshift_deployment_type is defined
  9. - openshift_deployment_type != deployment_type
  10. fail:
  11. msg: |-
  12. openshift_deployment_type is set to "{{ openshift_deployment_type }}".
  13. deployment_type is set to "{{ deployment_type }}".
  14. To avoid unexpected results, this conflict is not allowed.
  15. deployment_type is deprecated in favor of openshift_deployment_type.
  16. Please specify only openshift_deployment_type, or make both the same.
  17. - name: Standardize on latest variable names
  18. set_fact:
  19. # goal is to deprecate deployment_type in favor of openshift_deployment_type.
  20. # both will be accepted for now, but code should refer to the new name.
  21. # TODO: once this is well-documented, add deprecation notice if using old name.
  22. deployment_type: "{{ openshift_deployment_type | default(deployment_type) | default | string }}"
  23. openshift_deployment_type: "{{ openshift_deployment_type | default(deployment_type) | default | string }}"
  24. deployment_subtype: "{{ openshift_deployment_subtype | default(deployment_subtype) | default('basic') | string }}"
  25. openshift_deployment_subtype: "{{ openshift_deployment_subtype | default(deployment_subtype) | default('basic') | string }}"
  26. - name: Abort when deployment type is invalid
  27. # this variable is required; complain early and clearly if it is invalid.
  28. when: openshift_deployment_type not in known_openshift_deployment_types
  29. fail:
  30. msg: |-
  31. Please set openshift_deployment_type to one of:
  32. {{ known_openshift_deployment_types | join(', ') }}
  33. - name: Normalize openshift_release
  34. set_fact:
  35. # Normalize release if provided, e.g. "v3.5" => "3.5"
  36. # Currently this is not required to be defined for all installs, and the
  37. # `openshift_version` role can generally figure out the specific version
  38. # that gets installed (e.g. 3.5.0.1). So consider this the user's expressed
  39. # intent (if any), not the authoritative version that will be installed.
  40. openshift_release: "{{ openshift_release | string | regex_replace('^v', '') }}"
  41. when: openshift_release is defined
  42. - name: Abort when openshift_release is invalid
  43. when:
  44. - openshift_release is defined
  45. - not openshift_release | match('\d+(\.\d+){1,3}$')
  46. fail:
  47. msg: |-
  48. openshift_release is "{{ openshift_release }}" which is not a valid version string.
  49. Please set it to a version string like "3.4".
  50. - include: unsupported.yml
  51. when:
  52. - not openshift_enable_unsupported_configurations | default(false) | bool