docker_upgrade.yml 2.1 KB

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