main.yml 1.8 KB

1234567891011121314151617181920212223242526272829303132333435
  1. ---
  2. # It's important that we don't explicitly pull this image here. Otherwise we
  3. # could result in upgrading a preinstalled environment. We'll have to set
  4. # openshift_image_tag correctly for upgrades.
  5. - set_fact:
  6. is_containerized: "{{ openshift.common.is_containerized | default(False) | bool }}"
  7. # If no openshift_version provided, figure out what to use:
  8. # TODO: May want to move this to another role.
  9. - name: Lookup latest OpenShift version if none specified
  10. command: >
  11. docker run --rm {{ openshift.common.cli_image }}:latest version
  12. register: cli_image_version
  13. when: is_containerized | bool and openshift_version is not defined
  14. - debug: var=cli_image_version
  15. - set_fact:
  16. 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:] }}"
  17. when: is_containerized | bool and openshift_version is not defined
  18. # If we got an openshift_version like "3.2", lookup the latest 3.2 container version
  19. # and use that value instead.
  20. - name: Lookup specific OpenShift version if generic release specified
  21. command: >
  22. docker run --rm {{ openshift.common.cli_image }}:v{{ openshift_version }} version
  23. register: cli_image_version
  24. when: is_containerized | bool and openshift_version is defined and openshift_version.split('.') | length == 2
  25. - set_fact:
  26. 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:] }}"
  27. when: is_containerized | bool and openshift_version is defined and openshift_version.split('.') | length == 2
  28. - debug: var=openshift_version