upgrade.yml 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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 {{ ansible_nodename | lower }}
  10. --kubeconfig={{ openshift_node_kubeconfig_path }}
  11. delegate_to: localhost
  12. - name: Drain node prior to upgrade
  13. command: >
  14. oc adm drain {{ ansible_nodename | lower }}
  15. --kubeconfig={{ openshift_node_kubeconfig_path }}
  16. --force --delete-local-data --ignore-daemonsets
  17. delegate_to: localhost
  18. # Run the openshift_node_pre_upgrade_hook if defined
  19. - block:
  20. - debug:
  21. msg: "Running node openshift_node_pre_upgrade_hook {{ openshift_node_pre_upgrade_hook }}"
  22. - include_tasks: "{{ openshift_node_pre_upgrade_hook }}"
  23. when: openshift_node_pre_upgrade_hook is defined
  24. # Upgrade Node Packages
  25. - import_tasks: install.yml
  26. # Apply machine config
  27. - import_tasks: apply_machine_config.yml
  28. # Run the openshift_node_pre_uncordon_hook if defined
  29. - block:
  30. - debug:
  31. msg: "Running openshift_node_pre_uncordon_hook {{ openshift_node_pre_uncordon_hook }}"
  32. - include_tasks: "{{ openshift_node_pre_uncordon_hook }}"
  33. when: openshift_node_pre_uncordon_hook is defined
  34. - name: Uncordon node after upgrade
  35. command: >
  36. oc adm uncordon {{ ansible_nodename | lower }}
  37. --kubeconfig={{ openshift_node_kubeconfig_path }}
  38. delegate_to: localhost
  39. # Run the openshift_node_post_upgrade_hook if defined
  40. - block:
  41. - debug:
  42. msg: "Running node openshift_node_post_upgrade_hook {{ openshift_node_post_upgrade_hook }}"
  43. - include_tasks: "{{ openshift_node_post_upgrade_hook }}"
  44. when: openshift_node_post_upgrade_hook is defined