upgrade.yml 1.4 KB

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