summaryrefslogtreecommitdiffstats
path: root/playbooks/common/openshift-cluster/upgrades/docker/upgrade.yml
blob: 5fa4b7355bb5332054742094811dc2f764b1add9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
---
# We need docker service up to remove all the images, but these services will keep
# trying to re-start and thus re-pull the images we're trying to delete.
- name: Stop containerized services
  service: name={{ item }} state=stopped
  with_items:
    - "{{ openshift.common.service_type }}-master"
    - "{{ openshift.common.service_type }}-master-api"
    - "{{ openshift.common.service_type }}-master-controllers"
    - "{{ openshift.common.service_type }}-node"
    - etcd_container
    - openvswitch
  failed_when: false
  when: openshift.common.is_containerized | bool

- name: Remove all containers and images
  script: nuke_images.sh docker
  register: nuke_images_result
  when: docker_upgrade_nuke_images is defined and docker_upgrade_nuke_images | bool

- service: name=docker state=stopped

- name: Upgrade Docker
  action: "{{ ansible_pkg_mgr }} name=docker{{ '-' + docker_version }} state=present"

- service: name=docker state=started

- name: Restart containerized services
  service: name={{ item }} state=started
  with_items:
    - etcd_container
    - openvswitch
    - "{{ openshift.common.service_type }}-master"
    - "{{ openshift.common.service_type }}-master-api"
    - "{{ openshift.common.service_type }}-master-controllers"
    - "{{ openshift.common.service_type }}-node"
  failed_when: false
  when: openshift.common.is_containerized | bool

- name: Wait for master API to come back online
  become: no
  local_action:
    module: wait_for
      host="{{ inventory_hostname }}"
      state=started
      delay=10
      port="{{ openshift.master.api_port }}"
  when: inventory_hostname in groups.oo_masters_to_config