Browse Source

Adds node hooks: pre, mid and post update hook.

mid hook after updating the node, but before making it schedulable again.
jtudelag 7 years ago
parent
commit
3471bdddd8
1 changed files with 22 additions and 0 deletions
  1. 22 0
      playbooks/common/openshift-cluster/upgrades/upgrade_nodes.yml

+ 22 - 0
playbooks/common/openshift-cluster/upgrades/upgrade_nodes.yml

@@ -46,10 +46,25 @@
     - l_upgrade_nodes_drain_result is failed
     - openshift_upgrade_nodes_drain_timeout | default(0) | int == 0
 
+  # Run the pre-upgrade hook if defined:
+  - debug: msg="Running node pre-upgrade hook {{ openshift_node_upgrade_pre_hook }}"
+    when: openshift_node_upgrade_pre_hook is defined
+
+  - include_tasks: "{{ openshift_node_upgrade_pre_hook }}"
+    when: openshift_node_upgrade_pre_hook is defined
+
   post_tasks:
   - import_role:
       name: openshift_node
       tasks_from: upgrade.yml
+
+  # Run the upgrade hook prior to make the node schedulable again.
+  - debug: msg="Running node upgrade hook {{ openshift_node_upgrade_hook }}"
+    when: openshift_node_upgrade_hook is defined
+
+  - include_tasks: "{{ openshift_node_upgrade_hook }}"
+    when: openshift_node_upgrade_hook is defined
+
   - name: Set node schedulability
     oc_adm_manage_node:
       node: "{{ openshift.node.nodename | lower }}"
@@ -68,3 +83,10 @@
       name: openshift_excluder
     vars:
       r_openshift_excluder_action: enable
+
+  # Run the post-upgrade hook if defined:
+  - debug: msg="Running node post-upgrade hook {{ openshift_node_upgrade_post_hook }}"
+    when: openshift_node_upgrade_post_hook is defined
+
+  - include_tasks: "{{ openshift_node_upgrade_post_hook }}"
+    when: openshift_node_upgrade_post_hook is defined