upgrade.yml 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. ---
  2. # We need docker service up to remove all the images, but these services will keep
  3. # trying to re-start and thus re-pull the images we're trying to delete.
  4. - name: Stop containerized services
  5. service: name={{ item }} state=stopped
  6. with_items:
  7. - "{{ openshift.common.service_type }}-master"
  8. - "{{ openshift.common.service_type }}-master-api"
  9. - "{{ openshift.common.service_type }}-master-controllers"
  10. - "{{ openshift.common.service_type }}-node"
  11. - etcd_container
  12. - openvswitch
  13. failed_when: false
  14. when: openshift.common.is_containerized | bool
  15. - name: Check Docker image count
  16. shell: "docker images -aq | wc -l"
  17. register: docker_image_count
  18. - debug: var=docker_image_count.stdout
  19. - name: Remove all containers and images
  20. script: nuke_images.sh docker
  21. register: nuke_images_result
  22. when: docker_upgrade_nuke_images is defined and docker_upgrade_nuke_images | bool
  23. - name: Check Docker image count
  24. shell: "docker images -aq | wc -l"
  25. register: docker_image_count
  26. when: docker_upgrade_nuke_images is defined and docker_upgrade_nuke_images | bool
  27. - debug: var=docker_image_count.stdout
  28. when: docker_upgrade_nuke_images is defined and docker_upgrade_nuke_images | bool
  29. - service: name=docker state=stopped
  30. - name: Upgrade Docker
  31. action: "{{ ansible_pkg_mgr }} name=docker{{ '-' + docker_version }} state=present"
  32. - service: name=docker state=started
  33. - name: Update docker facts
  34. openshift_facts:
  35. role: docker
  36. - name: Restart containerized services
  37. service: name={{ item }} state=started
  38. with_items:
  39. - etcd_container
  40. - openvswitch
  41. - "{{ openshift.common.service_type }}-master"
  42. - "{{ openshift.common.service_type }}-master-api"
  43. - "{{ openshift.common.service_type }}-master-controllers"
  44. - "{{ openshift.common.service_type }}-node"
  45. failed_when: false
  46. when: openshift.common.is_containerized | bool
  47. - name: Wait for master API to come back online
  48. become: no
  49. local_action:
  50. module: wait_for
  51. host="{{ inventory_hostname }}"
  52. state=started
  53. delay=10
  54. port="{{ openshift.master.api_port }}"
  55. when: inventory_hostname in groups.oo_masters_to_config