summaryrefslogtreecommitdiffstats
path: root/playbooks/adhoc/upgrades/upgrade.yml
diff options
context:
space:
mode:
authorJason DeTiberus <jdetiber@redhat.com>2015-11-05 15:42:30 -0500
committerJason DeTiberus <jdetiber@redhat.com>2015-11-05 17:12:27 -0500
commite9680cc1020f9c54221993b3ae816b046d92bafc (patch)
tree52d21f36bfdd7edc21a0a888fe1cb26068c42e97 /playbooks/adhoc/upgrades/upgrade.yml
parenteb4cfd5702e675219ae0d36df667e0029b353921 (diff)
downloadopenshift-e9680cc1020f9c54221993b3ae816b046d92bafc.tar.gz
openshift-e9680cc1020f9c54221993b3ae816b046d92bafc.tar.bz2
openshift-e9680cc1020f9c54221993b3ae816b046d92bafc.tar.xz
openshift-e9680cc1020f9c54221993b3ae816b046d92bafc.zip
Additional upgrade enhancements
- rework the version checking - provide better safety if the apiLevel attributes are missing - ensure a list of api levels are present - remove a list of api levels - pylint fixes
Diffstat (limited to 'playbooks/adhoc/upgrades/upgrade.yml')
-rw-r--r--playbooks/adhoc/upgrades/upgrade.yml73
1 files changed, 25 insertions, 48 deletions
diff --git a/playbooks/adhoc/upgrades/upgrade.yml b/playbooks/adhoc/upgrades/upgrade.yml
index d9abff040..3b3609dca 100644
--- a/playbooks/adhoc/upgrades/upgrade.yml
+++ b/playbooks/adhoc/upgrades/upgrade.yml
@@ -87,50 +87,29 @@
local_facts:
deployment_type: "{{ deployment_type }}"
-- name: Upgrade base package on masters
- hosts: masters
- roles:
- - openshift_facts
- vars:
- openshift_version: "{{ openshift_pkg_version | default('') }}"
- tasks:
- - name: Upgrade base package
- yum:
- pkg: "{{ openshift.common.service_type }}{{ openshift_version }}"
- state: latest
-
-# TODO: ideally we would check the new version, without installing it. (some
-# kind of yum repoquery? would need to handle openshift -> atomic-openshift
-# package rename)
- name: Perform upgrade version checking
hosts: masters[0]
tasks:
- - name: Determine available version
- shell: >
- yum list available {{ openshift.common.service_type }} | tail -n 1 | cut -f 2 -d " " | cut -f 1 -d "-"
- register: _new_version
- - debug: var=_new_version
- # The above check will return nothing if the package is already installed,
- # and we may be re-running upgrade due to a failure.
- - name: Determine installed version
- command: >
- rpm -q --queryformat '%{version}' {{ openshift.common.service_type }}
- register: _new_version
- when: _new_version.stdout == ""
- # Fail if we still don't know:
- - debug: var=_new_version
- - name: Verify upgrade version
- fail: Unable to determine upgrade version for {{ openshift.common.service_type }}
- when: _new_version.stdout == ""
-
- - fail:
- msg: This playbook requires Atomic OpenShift 3.0.2 or later
- when: deployment_type in ['openshift_enterprise', 'atomic-enterprise'] and g_new_version.stdout | version_compare('3.0','>=') and g_new_version.stdout | version_compare('3.0.2','<')
-
- - fail:
- msg: This playbook requires Origin 1.0.6 or later
- when: deployment_type == 'origin'
+ - name: Clean yum cache
+ command: yum clean all
+
+ - name: Determine available versions
+ script: files/versions.sh {{ openshift.common.service_type }} openshift
+ register: g_versions_result
+
+ - set_fact:
+ g_aos_versions: "{{ g_versions_result.stdout | from_yaml }}"
+
+ - set_fact:
+ g_new_version: "{{ g_aos_versions.curr_version.split('-', 1).0 if g_aos_versions.avail_version is none else g_aos_versions.avail_version.split('-', 1).0 }}"
+
+ - fail: This playbook requires Origin 1.0.6 or later
+ when: deployment_type == 'origin' and g_aos_versions.curr_version | version_compare('1.0.6','<')
+
+ - fail: This playbook requires Atomic OpenShift 3.0.2 or later
+ when: deployment_type in ['openshift-enterprise', 'atomic-openshift'] and g_aos_versions.curr_version | version_compare('3.0.2','<')
+
- name: Upgrade masters
hosts: masters
@@ -142,10 +121,6 @@
pkg: kernel
state: latest
- - name: display just the deployment_type variable for the current host
- debug:
- var: hostvars[inventory_hostname].openshift.common.deployment_type
-
- name: Upgrade master packages
command: yum update -y {{ openshift.common.service_type }}-master{{ openshift_version }}
@@ -154,6 +129,8 @@
pkg: python-yaml
state: installed
+ - debug: var=hostvars[inventory_hostname].openshift.common.config_base
+
- name: Upgrade master configuration
openshift_upgrade_config:
from_version: '3.0'
@@ -253,8 +230,8 @@
- name: Update cluster policy and policy bindings
hosts: masters[0]
vars:
- origin_reconcile_bindings: "{{ deployment_type == 'origin' and gg_new_version.stdout | version_compare('1.0.6', '>') }}"
- ent_reconcile_bindings: "{{ deployment_type in ['openshift-enterprise', 'atomic-enterprise'] and gg_new_version.stdout | version_compare('3.0.2','>') }}"
+ origin_reconcile_bindings: "{{ deployment_type == 'origin' and g_new_version | version_compare('1.0.6', '>') }}"
+ ent_reconcile_bindings: "{{ deployment_type in ['openshift-enterprise', 'atomic-enterprise'] and g_new_version | version_compare('3.0.2','>') }}"
tasks:
- name: oadm policy reconcile-cluster-roles --confirm
command: >
@@ -282,8 +259,8 @@
- name: Upgrade default router and registry
hosts: masters[0]
vars:
- - registry_image: "{{ openshift.master.registry_url | replace( '${component}', 'docker-registry' ) | replace ( '${version}', 'v' + g_new_version.stdout ) }}"
- - router_image: "{{ openshift.master.registry_url | replace( '${component}', 'haproxy-router' ) | replace ( '${version}', 'v' + g_new_version.stdout ) }}"
+ - registry_image: "{{ openshift.master.registry_url | replace( '${component}', 'docker-registry' ) | replace ( '${version}', 'v' + g_new_version ) }}"
+ - router_image: "{{ openshift.master.registry_url | replace( '${component}', 'haproxy-router' ) | replace ( '${version}', 'v' + g_new_version ) }}"
- oc_cmd: "{{ openshift.common.client_binary }} --config={{ openshift.common.config_base }}/master/admin.kubeconfig"
tasks:
- name: Check for default router