main.yml 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. ---
  2. # Determine the openshift_version to configure if none has been specified or set previously.
  3. - set_fact:
  4. is_containerized: "{{ openshift.common.is_containerized | default(False) | bool }}"
  5. # Block attempts to install origin without specifying some kind of version information.
  6. # This is because the latest tags for origin are usually alpha builds, which should not
  7. # be used by default. Users must indicate what they want.
  8. - fail:
  9. msg: "Must specify openshift_release or openshift_image_tag in inventory to install origin. (suggestion: add openshift_release=\"1.2\" to inventory)"
  10. when: is_containerized | bool and openshift.common.deployment_type == 'origin' and openshift_release is not defined and openshift_image_tag is not defined
  11. # Make sure we copy this to a fact if given a var:
  12. - set_fact:
  13. openshift_version: "{{ openshift_version }}"
  14. when: openshift_version is defined
  15. # Protect the installed version by default unless explicitly told not to, or given an
  16. # openshift_version already.
  17. - name: Use openshift.common.version fact as version to configure if already installed
  18. set_fact:
  19. openshift_version: "{{ openshift.common.version }}"
  20. when: openshift.common.version is defined and openshift_version is not defined and openshift_protect_installed_version
  21. - debug: var=is_containerized
  22. - debug: var=openshift_version
  23. - debug: msg="{{ openshift_version is defined }}"
  24. - debug: var=openshift_release
  25. - debug: var=openshift_pkg_version
  26. - debug: var=openshift_image_tag
  27. - debug: var=openshift.common.version
  28. - name: Set openshift_version for rpm installation
  29. include: set_version_rpm.yml
  30. when: not is_containerized | bool
  31. - name: Set openshift_version for containerized installation
  32. include: set_version_containerized.yml
  33. when: is_containerized | bool
  34. # At this point we know openshift_version is set appropriately. Now we set
  35. # openshift_image_tag and openshift_pkg_version, so all roles can always assume
  36. # each of this variables *will* be set correctly and can use them per their
  37. # intended purpose.
  38. - set_fact:
  39. openshift_image_tag: v{{ openshift_version }}
  40. when: openshift_image_tag is not defined
  41. - set_fact:
  42. openshift_pkg_version: -{{ openshift_version }}
  43. when: openshift_pkg_version is not defined
  44. - debug: var=openshift_version
  45. - debug: var=openshift_pkg_version
  46. - debug: var=openshift_image_tag
  47. - fail: openshift_version role was unable to set openshift_version
  48. when: openshift_version is not defined
  49. - fail: openshift_version role was unable to set openshift_image_tag
  50. when: openshift_image_tag is not defined
  51. - fail: openshift_version role was unable to set openshift_pkg_version
  52. when: openshift_pkg_version is not defined
  53. # We can't map an openshift_release to full rpm version like we can with containers, make sure
  54. # the rpm version we looked up matches the release requested and error out if not.
  55. - fail:
  56. msg: "Detected openshift version {{ openshift_version }} does not match requested openshift_release {{ openshift_release }}. You may need to adjust your yum repositories or specify an exact openshift_pkg_version."
  57. when: not is_containerized | bool and openshift_release is defined and not openshift_version | oo_startswith(openshift_release) | bool