Browse Source

Merge pull request #6816 from jtudelag/pre-post-node-hook

Adds node hooks: pre, mid and post update hook.
Scott Dodson 7 years ago
parent
commit
74e1fb8d67
1 changed files with 33 additions and 0 deletions
  1. 33 0
      playbooks/common/openshift-cluster/upgrades/upgrade_nodes.yml

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

@@ -46,10 +46,36 @@
     - 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 }}"
+      schedulable: True
+    delegate_to: "{{ groups.oo_first_master.0 }}"
+    retries: 10
+    delay: 5
+    register: node_schedulable
+    until: node_schedulable is succeeded
+    when: node_unschedulable is changed
+
   - import_role:
       name: openshift_manage_node
       tasks_from: config.yml
@@ -63,3 +89,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