docker_upgrade.yml 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. ---
  2. - include: ../../evaluate_groups.yml
  3. vars:
  4. # Do not allow adding hosts during upgrade.
  5. g_new_master_hosts: []
  6. g_new_node_hosts: []
  7. - include: ../initialize_nodes_to_upgrade.yml
  8. - name: Check for appropriate Docker versions
  9. hosts: oo_masters_to_config:oo_nodes_to_upgrade:oo_etcd_to_config
  10. roles:
  11. - openshift_facts
  12. tasks:
  13. - set_fact:
  14. repoquery_cmd: "{{ 'dnf repoquery --latest-limit 1 -d 0' if ansible_pkg_mgr == 'dnf' else 'repoquery --plugins' }}"
  15. - fail:
  16. msg: Cannot upgrade Docker on Atomic operating systems.
  17. when: openshift.common.is_atomic | bool
  18. - include: upgrade_check.yml
  19. when: docker_upgrade is not defined or docker_upgrade | bool
  20. # If a node fails, halt everything, the admin will need to clean up and we
  21. # don't want to carry on, potentially taking out every node. The playbook can safely be re-run
  22. # and will not take any action on a node already running the requested docker version.
  23. - name: Drain and upgrade nodes
  24. hosts: oo_masters_to_config:oo_nodes_to_upgrade:oo_etcd_to_config
  25. serial: 1
  26. any_errors_fatal: true
  27. roles:
  28. - lib_openshift
  29. tasks:
  30. - name: Mark node unschedulable
  31. oc_adm_manage_node:
  32. node: "{{ openshift.node.nodename | lower }}"
  33. schedulable: False
  34. delegate_to: "{{ groups.oo_first_master.0 }}"
  35. retries: 10
  36. delay: 5
  37. register: node_unschedulable
  38. until: node_unschedulable|succeeded
  39. when:
  40. - l_docker_upgrade is defined
  41. - l_docker_upgrade | bool
  42. - inventory_hostname in groups.oo_nodes_to_upgrade
  43. - name: Drain Node for Kubelet upgrade
  44. command: >
  45. {{ openshift.common.admin_binary }} drain {{ openshift.node.nodename }} --config={{ openshift.common.config_base }}/master/admin.kubeconfig --force --delete-local-data --ignore-daemonsets
  46. delegate_to: "{{ groups.oo_first_master.0 }}"
  47. when: l_docker_upgrade is defined and l_docker_upgrade | bool and inventory_hostname in groups.oo_nodes_to_upgrade
  48. register: l_docker_upgrade_drain_result
  49. until: not l_docker_upgrade_drain_result | failed
  50. retries: 60
  51. delay: 60
  52. - include: tasks/upgrade.yml
  53. when: l_docker_upgrade is defined and l_docker_upgrade | bool
  54. - name: Set node schedulability
  55. oc_adm_manage_node:
  56. node: "{{ openshift.node.nodename | lower }}"
  57. schedulable: True
  58. delegate_to: "{{ groups.oo_first_master.0 }}"
  59. retries: 10
  60. delay: 5
  61. register: node_schedulable
  62. until: node_schedulable|succeeded
  63. when: node_unschedulable|changed