summaryrefslogtreecommitdiffstats
path: root/roles
diff options
context:
space:
mode:
authorDevan Goodwin <dgoodwin@redhat.com>2016-05-24 09:46:33 -0300
committerDevan Goodwin <dgoodwin@redhat.com>2016-05-25 10:28:32 -0300
commit0c7433838c8c6409b8de907fcc946fc73fe90527 (patch)
tree0e0138faf3cb685ac8dd51df79ee25f50c1111b6 /roles
parent82a70f9cc1522d239212701ab6c9260cbf9dc8a7 (diff)
downloadopenshift-0c7433838c8c6409b8de907fcc946fc73fe90527.tar.gz
openshift-0c7433838c8c6409b8de907fcc946fc73fe90527.tar.bz2
openshift-0c7433838c8c6409b8de907fcc946fc73fe90527.tar.xz
openshift-0c7433838c8c6409b8de907fcc946fc73fe90527.zip
Work towards determining openshift_version when unspecified.
openshift_docker role was largely useless now, but also almost did what we needed. (deps ordering still needs to be changed) Remove defaulting of openshift_version.
Diffstat (limited to 'roles')
-rw-r--r--roles/openshift_cli/tasks/main.yml1
-rw-r--r--roles/openshift_common/defaults/main.yml1
-rw-r--r--roles/openshift_docker/tasks/main.yml19
-rw-r--r--roles/openshift_docker_facts/defaults/main.yml1
-rw-r--r--roles/openshift_docker_facts/tasks/main.yml4
-rwxr-xr-xroles/openshift_facts/library/openshift_facts.py2
-rw-r--r--roles/openshift_facts/tasks/main.yml1
-rw-r--r--roles/openshift_master/defaults/main.yml2
-rw-r--r--roles/openshift_master/tasks/main.yml2
-rw-r--r--roles/openshift_master_ca/vars/main.yml1
-rw-r--r--roles/openshift_node/defaults/main.yml1
11 files changed, 25 insertions, 10 deletions
diff --git a/roles/openshift_cli/tasks/main.yml b/roles/openshift_cli/tasks/main.yml
index 95711f95d..8679407dc 100644
--- a/roles/openshift_cli/tasks/main.yml
+++ b/roles/openshift_cli/tasks/main.yml
@@ -6,6 +6,7 @@
action: "{{ ansible_pkg_mgr }} name={{ openshift.common.service_type }}-clients state=present"
when: not openshift.common.is_containerized | bool
+# TODO: handle no openshift_version set?
- name: Pull CLI Image
command: >
docker pull {{ openshift.common.cli_image }}:v{{ openshift_version }}
diff --git a/roles/openshift_common/defaults/main.yml b/roles/openshift_common/defaults/main.yml
index e46af70c7..267c03605 100644
--- a/roles/openshift_common/defaults/main.yml
+++ b/roles/openshift_common/defaults/main.yml
@@ -1,4 +1,3 @@
---
openshift_cluster_id: 'default'
openshift_debug_level: 2
-openshift_version: "{{ openshift_pkg_version | default('') }}"
diff --git a/roles/openshift_docker/tasks/main.yml b/roles/openshift_docker/tasks/main.yml
index aaa472727..2ab31de8b 100644
--- a/roles/openshift_docker/tasks/main.yml
+++ b/roles/openshift_docker/tasks/main.yml
@@ -4,7 +4,20 @@
# openshift_image_tag correctly for upgrades.
- set_fact:
is_containerized: "{{ openshift.common.is_containerized | default(False) | bool }}"
- # Does the host already have an image tag fact, used to determine if it's a new node
- # in non-upgrade scenarios:
- has_image_tag_fact: "{{ hostvars[inventory_hostname].openshift.docker.openshift_image_tag is defined }}"
+
+# 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
+
+- debug: var=openshift_version
diff --git a/roles/openshift_docker_facts/defaults/main.yml b/roles/openshift_docker_facts/defaults/main.yml
index 7baa87ab8..ed97d539c 100644
--- a/roles/openshift_docker_facts/defaults/main.yml
+++ b/roles/openshift_docker_facts/defaults/main.yml
@@ -1,2 +1 @@
---
-openshift_version: "{{ openshift_image_tag | default(openshift.docker.openshift_image_tag | default('')) }}"
diff --git a/roles/openshift_docker_facts/tasks/main.yml b/roles/openshift_docker_facts/tasks/main.yml
index 43359dcb5..bc3637351 100644
--- a/roles/openshift_docker_facts/tasks/main.yml
+++ b/roles/openshift_docker_facts/tasks/main.yml
@@ -57,6 +57,8 @@
l_common_version: "{{ common_version.stdout | default('0.0', True) }}"
when: not openshift.common.is_containerized | bool
+- debug: var=l_common_version
+
- name: Set docker version to be installed
set_fact:
docker_version: "{{ '1.8.2' }}"
@@ -68,3 +70,5 @@
docker_version: "{{ '1.9.1' }}"
when: " ( l_common_version | version_compare('3.2','>') and openshift.common.service_type == 'atomic-openshift' ) or
( l_common_version | version_compare('1.2','>') and openshift.common.service_type == 'origin' )"
+
+- debug: var=docker_version
diff --git a/roles/openshift_facts/library/openshift_facts.py b/roles/openshift_facts/library/openshift_facts.py
index 6127948bf..33596cd3e 100755
--- a/roles/openshift_facts/library/openshift_facts.py
+++ b/roles/openshift_facts/library/openshift_facts.py
@@ -1134,6 +1134,8 @@ def get_openshift_version(facts):
_, output, _ = module.run_command(['/usr/bin/openshift', 'version'])
version = parse_openshift_version(output)
elif os.path.isfile('/usr/local/bin/openshift'):
+ # TODO: this should probably make sure the actual image is already present, this can take awhile if it has to pull
+ # and is falsely acting like openshift is already installed
_, output, _ = module.run_command(['/usr/local/bin/openshift', 'version'])
version = parse_openshift_version(output)
diff --git a/roles/openshift_facts/tasks/main.yml b/roles/openshift_facts/tasks/main.yml
index ca1a9b1e4..c67f6b86a 100644
--- a/roles/openshift_facts/tasks/main.yml
+++ b/roles/openshift_facts/tasks/main.yml
@@ -41,3 +41,4 @@
no_proxy: "{{ openshift_no_proxy | default(None) }}"
generate_no_proxy_hosts: "{{ openshift_generate_no_proxy_hosts | default(True) }}"
no_proxy_internal_hostnames: "{{ openshift_no_proxy_internal_hostnames | default(None) }}"
+ version_requested: "{{ openshift_version | default(None) }}"
diff --git a/roles/openshift_master/defaults/main.yml b/roles/openshift_master/defaults/main.yml
index dbd62c80f..14a1daf6c 100644
--- a/roles/openshift_master/defaults/main.yml
+++ b/roles/openshift_master/defaults/main.yml
@@ -1,4 +1,4 @@
---
openshift_node_ips: []
# TODO: update setting these values based on the facts
-openshift_version: "{{ openshift_pkg_version | default(openshift_image_tag | default(openshift.docker.openshift_image_tag | default(''))) }}"
+#openshift_version: "{{ openshift_pkg_version | default(openshift_image_tag | default(openshift.docker.openshift_image_tag | default(''))) }}"
diff --git a/roles/openshift_master/tasks/main.yml b/roles/openshift_master/tasks/main.yml
index 0cbb49758..6870def5f 100644
--- a/roles/openshift_master/tasks/main.yml
+++ b/roles/openshift_master/tasks/main.yml
@@ -25,8 +25,6 @@
msg: "Pacemaker based HA is not supported at this time when used with containerized installs"
when: openshift_master_ha | bool and openshift_master_cluster_method == "pacemaker" and openshift.common.is_containerized | bool
-- debug: var=openshift_version
-
- name: Install Master package
action: "{{ ansible_pkg_mgr }} name={{ openshift.common.service_type }}-master{{ openshift_version | default('') | oo_image_tag_to_rpm_version(include_dash=True) }} state=present"
when: not openshift.common.is_containerized | bool
diff --git a/roles/openshift_master_ca/vars/main.yml b/roles/openshift_master_ca/vars/main.yml
index b35339b18..1f6af808c 100644
--- a/roles/openshift_master_ca/vars/main.yml
+++ b/roles/openshift_master_ca/vars/main.yml
@@ -3,4 +3,3 @@ openshift_master_config_dir: "{{ openshift.common.config_base }}/master"
openshift_master_ca_cert: "{{ openshift_master_config_dir }}/ca.crt"
openshift_master_ca_key: "{{ openshift_master_config_dir }}/ca.key"
openshift_master_ca_serial: "{{ openshift_master_config_dir }}/ca.serial.txt"
-openshift_version: "{{ openshift_pkg_version | default('') }}"
diff --git a/roles/openshift_node/defaults/main.yml b/roles/openshift_node/defaults/main.yml
index 91aed7aa3..fffbf2994 100644
--- a/roles/openshift_node/defaults/main.yml
+++ b/roles/openshift_node/defaults/main.yml
@@ -13,4 +13,3 @@ os_firewall_allow:
- service: OpenShift OVS sdn
port: 4789/udp
when: openshift.node.use_openshift_sdn | bool
-openshift_version: "{{ openshift_pkg_version | default(openshift_image_tag | default(openshift.docker.openshift_image_tag | default(''))) }}"