set_version_containerized.yml 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. ---
  2. - name: Set containerized version to configure if openshift_image_tag specified
  3. set_fact:
  4. openshift_version: "{{ openshift_image_tag.split('v',1)[1] }}"
  5. when: openshift_image_tag is defined and openshift_version is not defined
  6. - name: Set containerized version to configure if openshift_release specified
  7. set_fact:
  8. openshift_version: "{{ openshift_release }}"
  9. when: openshift_release is defined and openshift_version is not defined
  10. - name: Lookup latest containerized version if no version specified
  11. command: >
  12. docker run --rm {{ openshift.common.cli_image }}:latest version
  13. register: cli_image_version
  14. when: openshift_version is not defined
  15. - debug: var=cli_image_version
  16. - set_fact:
  17. 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:] }}"
  18. when: openshift_version is not defined
  19. - debug: msg="{{ openshift_version }}"
  20. # If we got an openshift_version like "3.2", lookup the latest 3.2 container version
  21. # and use that value instead.
  22. - name: Set precise containerized version to configure if openshift_release specified
  23. command: >
  24. docker run --rm {{ openshift.common.cli_image }}:v{{ openshift_version }} version
  25. register: cli_image_version
  26. when: openshift_version is defined and openshift_version.split('.') | length == 2
  27. - set_fact:
  28. 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:] }}"
  29. when: openshift_version is defined and openshift_version.split('.') | length == 2