123456789101112131415161718192021222324252627282930313233343536373839 |
- ---
- - name: Set containerized version to configure if openshift_image_tag specified
- set_fact:
- # Expects a leading "v" in inventory, strip it off here:
- # openshift_version should always just be "3.2" or "3.2.0.44"
- openshift_version: "{{ openshift_image_tag[1:].split('-')[0] }}"
- when: openshift_image_tag is defined and openshift_version is not defined
- - name: Set containerized version to configure if openshift_release specified
- set_fact:
- openshift_version: "{{ openshift_release }}"
- when: openshift_release is defined and openshift_version is not defined
- - name: Lookup latest containerized version if no version specified
- command: >
- docker run --rm {{ openshift.common.cli_image }}:latest version
- register: cli_image_version
- when: openshift_version is not defined
- - debug: var=cli_image_version
- - set_fact:
- 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:] }}"
- when: openshift_version is not defined
- - debug: msg="{{ openshift_version }}"
- # If we got an openshift_version like "3.2", lookup the latest 3.2 container version
- # and use that value instead.
- - name: Set precise containerized version to configure if openshift_release specified
- command: >
- docker run --rm {{ openshift.common.cli_image }}:v{{ openshift_version }} version
- register: cli_image_version
- when: openshift_version is defined and openshift_version.split('.') | length == 2
- - set_fact:
- 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:] }}"
- when: openshift_version is defined and openshift_version.split('.') | length == 2
|