upgrade.yml 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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 Packages
  27. - import_tasks: install.yml
  28. vars:
  29. openshift_node_package_state: latest
  30. # Apply machine config
  31. - import_tasks: apply_machine_config.yml
  32. # Run the openshift_node_pre_uncordon_hook if defined
  33. - block:
  34. - debug:
  35. msg: "Running openshift_node_pre_uncordon_hook {{ openshift_node_pre_uncordon_hook }}"
  36. - include_tasks: "{{ openshift_node_pre_uncordon_hook }}"
  37. when: openshift_node_pre_uncordon_hook is defined
  38. - name: Uncordon node after upgrade
  39. command: >
  40. oc adm uncordon {{ item | lower }}
  41. --config={{ openshift_node_kubeconfig_path }}
  42. delegate_to: localhost
  43. with_items: "{{ ansible_play_batch }}"
  44. # Run the openshift_node_post_upgrade_hook if defined
  45. - block:
  46. - debug:
  47. msg: "Running node openshift_node_post_upgrade_hook {{ openshift_node_post_upgrade_hook }}"
  48. - include_tasks: "{{ openshift_node_post_upgrade_hook }}"
  49. when: openshift_node_post_upgrade_hook is defined