summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDevan Goodwin <dgoodwin@redhat.com>2017-01-17 14:55:46 -0400
committerDevan Goodwin <dgoodwin@redhat.com>2017-01-19 11:00:07 -0400
commit2c91510d4ce3baa92e8e054223659e4e3fa5dbcd (patch)
tree63834fd06ad16867b5f9e61116ccc1e91750b43f
parent5a554ef3c2892f71c4c0c6be162185f312ba67e7 (diff)
downloadopenshift-2c91510d4ce3baa92e8e054223659e4e3fa5dbcd.tar.gz
openshift-2c91510d4ce3baa92e8e054223659e4e3fa5dbcd.tar.bz2
openshift-2c91510d4ce3baa92e8e054223659e4e3fa5dbcd.tar.xz
openshift-2c91510d4ce3baa92e8e054223659e4e3fa5dbcd.zip
Implement pre/post master upgrade hooks.
-rw-r--r--inventory/byo/hosts.origin.example15
-rw-r--r--inventory/byo/hosts.ose.example15
-rw-r--r--playbooks/common/openshift-cluster/upgrades/upgrade_control_plane.yml9
3 files changed, 39 insertions, 0 deletions
diff --git a/inventory/byo/hosts.origin.example b/inventory/byo/hosts.origin.example
index dde172c4a..062a776b0 100644
--- a/inventory/byo/hosts.origin.example
+++ b/inventory/byo/hosts.origin.example
@@ -89,6 +89,21 @@ openshift_release=v1.4
# Skip upgrading Docker during an OpenShift upgrade, leaves the current Docker version alone.
# docker_upgrade=False
+
+# Upgrade Hooks
+#
+# Hooks are available to run custom tasks at various points during a cluster
+# upgrade. Each hook should point to a file with Ansible tasks defined. Suggest using
+# absolute paths, if not the path will be treated as relative to the file where the
+# hook is actually used.
+#
+# Tasks to run before each master is upgraded:
+# openshift_upgrade_pre_master_hook=/usr/share/custom/pre_master.yml
+#
+# Tasks to run after each master is upgraded:
+# openshift_upgrade_post_master_hook=/usr/share/custom/post_master.yml
+
+
# Alternate image format string, useful if you've got your own registry mirror
#oreg_url=example.com/openshift3/ose-${component}:${version}
# If oreg_url points to a registry other than registry.access.redhat.com we can
diff --git a/inventory/byo/hosts.ose.example b/inventory/byo/hosts.ose.example
index c0dd8a1e8..bcc2373ce 100644
--- a/inventory/byo/hosts.ose.example
+++ b/inventory/byo/hosts.ose.example
@@ -89,6 +89,21 @@ openshift_release=v3.4
# Skip upgrading Docker during an OpenShift upgrade, leaves the current Docker version alone.
# docker_upgrade=False
+
+# Upgrade Hooks
+#
+# Hooks are available to run custom tasks at various points during a cluster
+# upgrade. Each hook should point to a file with Ansible tasks defined. Suggest using
+# absolute paths, if not the path will be treated as relative to the file where the
+# hook is actually used.
+#
+# Tasks to run before each master is upgraded:
+# openshift_upgrade_pre_master_hook=/usr/share/custom/pre_master.yml
+#
+# Tasks to run after each master is upgraded:
+# openshift_upgrade_post_master_hook=/usr/share/custom/post_master.yml
+
+
# Alternate image format string, useful if you've got your own registry mirror
#oreg_url=example.com/openshift3/ose-${component}:${version}
# If oreg_url points to a registry other than registry.access.redhat.com we can
diff --git a/playbooks/common/openshift-cluster/upgrades/upgrade_control_plane.yml b/playbooks/common/openshift-cluster/upgrades/upgrade_control_plane.yml
index 7f738ea0f..59e5010f5 100644
--- a/playbooks/common/openshift-cluster/upgrades/upgrade_control_plane.yml
+++ b/playbooks/common/openshift-cluster/upgrades/upgrade_control_plane.yml
@@ -51,6 +51,8 @@
roles:
- openshift_master_facts
+# The main master upgrade play. Should handle all changes to the system in one pass, with
+# support for optional hooks to be defined.
- name: Upgrade master
hosts: oo_masters_to_config
vars:
@@ -62,6 +64,10 @@
roles:
- openshift_facts
post_tasks:
+
+ - include: "{{ openshift_upgrade_pre_master_hook }}"
+ when: openshift_upgrade_pre_master_hook is defined
+
- include: rpm_upgrade.yml component=master
when: not openshift.common.is_containerized | bool
@@ -108,6 +114,9 @@
- include: ../../openshift-master/restart_services.yml
when: openshift.common.rolling_restart_mode == 'services'
+ - include: "{{ openshift_upgrade_post_master_hook }}"
+ when: openshift_upgrade_post_master_hook is defined
+
- set_fact:
master_update_complete: True