upgrade_nodes.yml 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. ---
  2. - name: Evacuate and upgrade nodes
  3. hosts: oo_nodes_to_config
  4. serial: 1
  5. any_errors_fatal: true
  6. roles:
  7. - openshift_facts
  8. handlers:
  9. - include: ../../../../roles/openshift_node/handlers/main.yml
  10. static: yes
  11. tasks:
  12. # TODO: To better handle re-trying failed upgrades, it would be nice to check if the node
  13. # or docker actually needs an upgrade before proceeding. Perhaps best to save this until
  14. # we merge upgrade functionality into the base roles and a normal config.yml playbook run.
  15. - name: Determine if node is currently scheduleable
  16. command: >
  17. {{ openshift.common.client_binary }} get node {{ openshift.node.nodename | lower }} -o json
  18. register: node_output
  19. delegate_to: "{{ groups.oo_first_master.0 }}"
  20. changed_when: false
  21. when: inventory_hostname in groups.oo_nodes_to_config
  22. - set_fact:
  23. was_schedulable: "{{ 'unschedulable' not in (node_output.stdout | from_json).spec }}"
  24. when: inventory_hostname in groups.oo_nodes_to_config
  25. - name: Mark unschedulable if host is a node
  26. command: >
  27. {{ openshift.common.admin_binary }} manage-node {{ openshift.node.nodename | lower }} --schedulable=false
  28. delegate_to: "{{ groups.oo_first_master.0 }}"
  29. when: inventory_hostname in groups.oo_nodes_to_config
  30. - name: Evacuate Node for Kubelet upgrade
  31. command: >
  32. {{ openshift.common.admin_binary }} manage-node {{ openshift.node.nodename | lower }} --evacuate --force
  33. delegate_to: "{{ groups.oo_first_master.0 }}"
  34. when: inventory_hostname in groups.oo_nodes_to_config
  35. - include: docker/upgrade.yml
  36. when: l_docker_upgrade is defined and l_docker_upgrade | bool and not openshift.common.is_atomic | bool
  37. - include: "{{ node_config_hook }}"
  38. when: node_config_hook is defined and inventory_hostname in groups.oo_nodes_to_config
  39. - include: rpm_upgrade.yml
  40. vars:
  41. component: "node"
  42. openshift_version: "{{ openshift_pkg_version | default('') }}"
  43. when: inventory_hostname in groups.oo_nodes_to_config and not openshift.common.is_containerized | bool
  44. - include: containerized_node_upgrade.yml
  45. when: inventory_hostname in groups.oo_nodes_to_config and openshift.common.is_containerized | bool
  46. - meta: flush_handlers
  47. - name: Set node schedulability
  48. command: >
  49. {{ openshift.common.admin_binary }} manage-node {{ openshift.node.nodename | lower }} --schedulable=true
  50. delegate_to: "{{ groups.oo_first_master.0 }}"
  51. when: inventory_hostname in groups.oo_nodes_to_config and was_schedulable | bool