summaryrefslogtreecommitdiffstats
path: root/roles/openshift_docker/tasks/main.yml
blob: 1791d20c003bc4b88f0564e8e44a926eb6db57f5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
---
# It's important that we don't explicitly pull this image here.  Otherwise we
# could result in upgrading a preinstalled environment.  We'll have to set
# openshift_image_tag correctly for upgrades.
- set_fact:
    is_containerized: "{{ openshift.common.is_containerized | default(False) | bool }}"

# If no openshift_version provided, figure out what to use:
# TODO: May want to move this to another role.
- name: Lookup latest OpenShift version if none specified
  command: >
    docker run --rm {{ openshift.common.cli_image }}:latest version
  register: cli_image_version
  when: is_containerized | bool and 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: is_containerized | bool and openshift_version is not defined

# If we got an openshift_version like "3.2", lookup the latest 3.2 container version
# and use that value instead.
- name: Lookup specific OpenShift version if generic release specified
  command: >
    docker run --rm {{ openshift.common.cli_image }}:v{{ openshift_version }} version
  register: cli_image_version
  when: is_containerized | bool and 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: is_containerized | bool and openshift_version is defined and openshift_version.split('.') | length == 2

- debug: var=openshift_version