upgrade.yml 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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_service_type }}-master-api"
  8. - "{{ openshift_service_type }}-master-controllers"
  9. - "{{ openshift_service_type }}-node"
  10. - etcd_container
  11. - openvswitch
  12. failed_when: false
  13. when: openshift_is_containerized | bool
  14. - name: Restart static master services
  15. command: /usr/local/bin/master-restart "{{ item }}"
  16. with_items:
  17. - api
  18. - controllers
  19. - etcd
  20. failed_when: false
  21. - name: Check Docker image count
  22. shell: "docker images -aq | wc -l"
  23. register: docker_image_count
  24. - debug: var=docker_image_count.stdout
  25. - name: Remove all containers and images
  26. script: nuke_images.sh
  27. register: nuke_images_result
  28. when: docker_upgrade_nuke_images is defined and docker_upgrade_nuke_images | bool
  29. - name: Check Docker image count
  30. shell: "docker images -aq | wc -l"
  31. register: docker_image_count
  32. when: docker_upgrade_nuke_images is defined and docker_upgrade_nuke_images | bool
  33. - debug: var=docker_image_count.stdout
  34. when: docker_upgrade_nuke_images is defined and docker_upgrade_nuke_images | bool
  35. - service:
  36. name: docker
  37. state: stopped
  38. register: l_pb_docker_upgrade_stop_result
  39. until: not (l_pb_docker_upgrade_stop_result is failed)
  40. retries: 3
  41. delay: 30
  42. - name: Upgrade Docker
  43. package: name=docker{{ '-' + docker_version }} state=present
  44. register: result
  45. until: result is succeeded
  46. - include_tasks: restart.yml
  47. when: not skip_docker_restart | default(False) | bool