first_master_containerized_version.yml 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. ---
  2. - name: Set containerized version to configure if openshift_image_tag specified
  3. set_fact:
  4. # Expects a leading "v" in inventory, strip it off here unless
  5. # openshift_image_tag=latest
  6. openshift_version: "{{ openshift_image_tag[1:].split('-')[0] if openshift_image_tag != 'latest' else openshift_image_tag }}"
  7. when:
  8. - openshift_image_tag is defined
  9. - openshift_version is not defined
  10. - name: Set containerized version to configure if openshift_release specified
  11. set_fact:
  12. openshift_version: "{{ openshift_release }}"
  13. when:
  14. - openshift_release is defined
  15. - openshift_version is not defined
  16. - name: Lookup latest containerized version if no version specified
  17. command: >
  18. docker run --rm {{ openshift_cli_image }}:latest version
  19. register: cli_image_version
  20. when:
  21. - openshift_version is not defined
  22. - not openshift_use_crio_only
  23. # Origin latest = pre-release version (i.e. v1.3.0-alpha.1-321-gb095e3a)
  24. - set_fact:
  25. openshift_version: "{{ cli_image_version.stdout_lines[0].split(' ')[1].split('-')[0][1:] }}"
  26. when: openshift_version is not defined
  27. # If we got an openshift_version like "3.2", lookup the latest 3.2 container version
  28. # and use that value instead.
  29. - name: Set precise containerized version to configure if openshift_release specified
  30. command: >
  31. docker run --rm {{ openshift_cli_image }}:v{{ openshift_version }} version
  32. register: cli_image_version
  33. when:
  34. - openshift_version is defined
  35. - openshift_version.split('.') | length == 2
  36. - not openshift_use_crio_only
  37. - set_fact:
  38. openshift_version: "{{ cli_image_version.stdout_lines[0].split(' ')[1].split('-')[0][1:] }}"
  39. when:
  40. - openshift_version is defined
  41. - openshift_version.split('.') | length == 2
  42. - not openshift_use_crio_only
  43. # TODO: figure out a way to check for the openshift_version when using CRI-O.
  44. # We should do that using the images in the ostree storage so we don't have
  45. # to pull them again.
  46. # We finally have the specific version. Now we clean up any strange
  47. # dangly +c0mm1t-offset tags in the version. See also,
  48. # openshift_facts.py
  49. - set_fact:
  50. openshift_version: "{{ openshift_version | lib_utils_oo_chomp_commit_offset }}"