docker_upgrade.yml 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. - name: Check for appropriate Docker versions
  2. hosts: oo_masters_to_config:oo_nodes_to_config:oo_etcd_to_config
  3. roles:
  4. - openshift_facts
  5. tasks:
  6. - set_fact:
  7. repoquery_cmd: "{{ 'dnf repoquery --latest-limit 1 -d 0' if ansible_pkg_mgr == 'dnf' else 'repoquery --plugins' }}"
  8. - fail:
  9. msg: Cannot upgrade Docker on Atomic operating systems.
  10. when: openshift.common.is_atomic | bool
  11. - include: ../../../../common/openshift-cluster/upgrades/docker/upgrade_check.yml
  12. when: docker_upgrade is not defined or docker_upgrade | bool
  13. # If a node fails, halt everything, the admin will need to clean up and we
  14. # don't want to carry on, potentially taking out every node. The playbook can safely be re-run
  15. # and will not take any action on a node already running the requested docker version.
  16. - name: Evacuate and upgrade nodes
  17. hosts: oo_masters_to_config:oo_nodes_to_config:oo_etcd_to_config
  18. serial: 1
  19. any_errors_fatal: true
  20. tasks:
  21. - name: Prepare for Node evacuation
  22. command: >
  23. {{ openshift.common.client_binary }} adm manage-node {{ openshift.common.hostname | lower }} --schedulable=false
  24. delegate_to: "{{ groups.oo_first_master.0 }}"
  25. when: l_docker_upgrade is defined and l_docker_upgrade | bool and inventory_hostname in groups.oo_nodes_to_upgrade
  26. - name: Evacuate Node for Kubelet upgrade
  27. command: >
  28. {{ openshift.common.client_binary }} adm manage-node {{ openshift.common.hostname | lower }} --evacuate --force
  29. delegate_to: "{{ groups.oo_first_master.0 }}"
  30. when: l_docker_upgrade is defined and l_docker_upgrade | bool and inventory_hostname in groups.oo_nodes_to_upgrade
  31. - include: ../../../../common/openshift-cluster/upgrades/docker/upgrade.yml
  32. when: l_docker_upgrade is defined and l_docker_upgrade | bool
  33. - name: Set node schedulability
  34. command: >
  35. {{ openshift.common.client_binary }} adm manage-node {{ openshift.common.hostname | lower }} --schedulable=true
  36. delegate_to: "{{ groups.oo_first_master.0 }}"
  37. when: openshift.node.schedulable | bool
  38. when: l_docker_upgrade is defined and l_docker_upgrade | bool and inventory_hostname in groups.oo_nodes_to_upgrade and openshift.node.schedulable | bool