upgrade.yml 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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.common.is_containerized | bool
  14. - name: Check Docker image count
  15. shell: "docker images -aq | wc -l"
  16. register: docker_image_count
  17. - debug: var=docker_image_count.stdout
  18. - name: Remove all containers and images
  19. script: nuke_images.sh
  20. register: nuke_images_result
  21. when: docker_upgrade_nuke_images is defined and docker_upgrade_nuke_images | bool
  22. - name: Check Docker image count
  23. shell: "docker images -aq | wc -l"
  24. register: docker_image_count
  25. when: docker_upgrade_nuke_images is defined and docker_upgrade_nuke_images | bool
  26. - debug: var=docker_image_count.stdout
  27. when: docker_upgrade_nuke_images is defined and docker_upgrade_nuke_images | bool
  28. - service:
  29. name: docker
  30. state: stopped
  31. register: l_pb_docker_upgrade_stop_result
  32. until: not (l_pb_docker_upgrade_stop_result is failed)
  33. retries: 3
  34. delay: 30
  35. - name: Upgrade Docker
  36. package: name=docker{{ '-' + docker_version }} state=present
  37. register: result
  38. until: result is succeeded
  39. - include_tasks: restart.yml
  40. when: not skip_docker_restart | default(False) | bool