upgrade.yml 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. ---
  2. - block:
  3. - debug:
  4. msg: "Running openshift_node_pre_cordon_hook {{ openshift_node_pre_cordon_hook }}"
  5. - include_tasks: "{{ openshift_node_pre_cordon_hook }}"
  6. when: openshift_node_pre_cordon_hook is defined
  7. - name: Cordon node prior to upgrade
  8. command: >
  9. oc adm cordon {{ item | lower }}
  10. --config={{ openshift_node_kubeconfig_path }}
  11. delegate_to: localhost
  12. with_items: "{{ ansible_play_batch }}"
  13. - name: Drain node prior to upgrade
  14. command: >
  15. oc adm drain {{ item | lower }}
  16. --config={{ openshift_node_kubeconfig_path }}
  17. --force --delete-local-data --ignore-daemonsets
  18. delegate_to: localhost
  19. with_items: "{{ ansible_play_batch }}"
  20. # Run the openshift_node_pre_upgrade_hook if defined
  21. - block:
  22. - debug:
  23. msg: "Running node openshift_node_pre_upgrade_hook {{ openshift_node_pre_upgrade_hook }}"
  24. - include_tasks: "{{ openshift_node_pre_upgrade_hook }}"
  25. when: openshift_node_pre_upgrade_hook is defined
  26. # Upgrade Node
  27. - import_role:
  28. name: openshift_node
  29. vars:
  30. openshift_node_package_state: latest
  31. # Run the openshift_node_pre_uncordon_hook if defined
  32. - block:
  33. - debug:
  34. msg: "Running openshift_node_pre_uncordon_hook {{ openshift_node_pre_uncordon_hook }}"
  35. - include_tasks: "{{ openshift_node_pre_uncordon_hook }}"
  36. when: openshift_node_pre_uncordon_hook is defined
  37. - name: Uncordon node after upgrade
  38. command: >
  39. oc adm uncordon {{ item | lower }}
  40. --config={{ openshift_node_kubeconfig_path }}
  41. delegate_to: localhost
  42. with_items: "{{ ansible_play_batch }}"
  43. # Run the openshift_node_post_upgrade_hook if defined
  44. - block:
  45. - debug:
  46. msg: "Running node openshift_node_post_upgrade_hook {{ openshift_node_post_upgrade_hook }}"
  47. - include_tasks: "{{ openshift_node_post_upgrade_hook }}"
  48. when: openshift_node_post_upgrade_hook is defined