first_master_containerized_version.yml 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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. - not (openshift_version_reinit | default(false))
  11. - name: Set containerized version to configure if openshift_release specified
  12. set_fact:
  13. openshift_version: "{{ openshift_release }}"
  14. when:
  15. - openshift_release is defined
  16. - openshift_version is not defined
  17. - name: Lookup latest containerized version if no version specified
  18. command: >
  19. docker run --rm {{ openshift_cli_image }}:latest version
  20. register: cli_image_version
  21. when:
  22. - openshift_version is not defined or openshift_version_reinit | default(false)
  23. - not openshift_use_crio_only
  24. # Origin latest = pre-release version (i.e. v1.3.0-alpha.1-321-gb095e3a)
  25. - set_fact:
  26. openshift_version: "{{ (cli_image_version.stdout_lines[0].split(' ')[1].split('-')[0:2] | join('-'))[1:] }}"
  27. when:
  28. - openshift_version is not defined
  29. - openshift.common.deployment_type == 'origin'
  30. - cli_image_version.stdout_lines[0].split('-') | length > 1
  31. - not openshift_use_crio_only
  32. - set_fact:
  33. openshift_version: "{{ cli_image_version.stdout_lines[0].split(' ')[1].split('-')[0][1:] }}"
  34. when: openshift_version is not defined or openshift_version_reinit | default(false)
  35. # If we got an openshift_version like "3.2", lookup the latest 3.2 container version
  36. # and use that value instead.
  37. - name: Set precise containerized version to configure if openshift_release specified
  38. command: >
  39. docker run --rm {{ openshift_cli_image }}:v{{ openshift_version }} version
  40. register: cli_image_version
  41. when:
  42. - openshift_version is defined
  43. - openshift_version.split('.') | length == 2
  44. - not openshift_use_crio_only
  45. - set_fact:
  46. openshift_version: "{{ cli_image_version.stdout_lines[0].split(' ')[1].split('-')[0:2][1:] | join('-') if openshift.common.deployment_type == 'origin' else cli_image_version.stdout_lines[0].split(' ')[1].split('-')[0][1:] }}"
  47. when:
  48. - openshift_version is defined
  49. - openshift_version.split('.') | length == 2
  50. - not openshift_use_crio_only
  51. # TODO: figure out a way to check for the openshift_version when using CRI-O.
  52. # We should do that using the images in the ostree storage so we don't have
  53. # to pull them again.
  54. # We finally have the specific version. Now we clean up any strange
  55. # dangly +c0mm1t-offset tags in the version. See also,
  56. # openshift_facts.py
  57. - set_fact:
  58. openshift_version: "{{ openshift_version | lib_utils_oo_chomp_commit_offset }}"