From 82f4e4eaeaaf3059013e9ea23d87dcf89fd8455e Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Tue, 21 Jun 2016 15:01:01 -0300 Subject: Refactor 3.2 upgrade to avoid killing nodes without evac. We now handle the two pieces of upgrade that require a node evac in the same play. (docker, and node itself) --- .../openshift-cluster/upgrades/docker/upgrade.yml | 52 ++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 playbooks/common/openshift-cluster/upgrades/docker/upgrade.yml (limited to 'playbooks/common/openshift-cluster/upgrades/docker/upgrade.yml') diff --git a/playbooks/common/openshift-cluster/upgrades/docker/upgrade.yml b/playbooks/common/openshift-cluster/upgrades/docker/upgrade.yml new file mode 100644 index 000000000..78b123881 --- /dev/null +++ b/playbooks/common/openshift-cluster/upgrades/docker/upgrade.yml @@ -0,0 +1,52 @@ +--- +# 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: docker_upgrade is defined and docker_upgrade | bool and openshift.common.is_containerized | bool + +- name: remove all containers and images + script: nuke_images.sh docker + register: nuke_images_result + when: docker_upgrade is defined and docker_upgrade | bool + +# todo: should we use the docker role to actually do the upgrade? +- name: upgrade to specified docker version + action: "{{ ansible_pkg_mgr }} name=docker{{ '-' + docker_version }} state=present" + register: docker_upgrade_result + when: docker_upgrade is defined and docker_upgrade | bool and docker_version is defined + +- name: upgrade to latest docker version + action: "{{ ansible_pkg_mgr }} name=docker state=latest" + register: docker_upgrade_result + when: docker_upgrade is defined and docker_upgrade | bool and docker_version is not defined + +- 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: docker_upgrade is defined and docker_upgrade | bool and 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: docker_upgrade is defined and docker_upgrade | bool and inventory_hostname in groups.oo_masters_to_config -- cgit v1.2.3 From 08f1caed84d46d0263f0c1aaaf2da891946b1a96 Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Mon, 27 Jun 2016 11:15:40 -0300 Subject: Only nuke images when crossing the Docker 1.10 boundary in upgrade. --- .../openshift-cluster/upgrades/docker/upgrade.yml | 27 ++++++++-------------- 1 file changed, 10 insertions(+), 17 deletions(-) (limited to 'playbooks/common/openshift-cluster/upgrades/docker/upgrade.yml') diff --git a/playbooks/common/openshift-cluster/upgrades/docker/upgrade.yml b/playbooks/common/openshift-cluster/upgrades/docker/upgrade.yml index 78b123881..81db9ef20 100644 --- a/playbooks/common/openshift-cluster/upgrades/docker/upgrade.yml +++ b/playbooks/common/openshift-cluster/upgrades/docker/upgrade.yml @@ -1,7 +1,7 @@ --- # 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 +- name: Stop containerized services service: name={{ item }} state=stopped with_items: - "{{ openshift.common.service_type }}-master" @@ -11,25 +11,18 @@ - etcd_container - openvswitch failed_when: false - when: docker_upgrade is defined and docker_upgrade | bool and openshift.common.is_containerized | bool + when: docker_upgrade | bool and openshift.common.is_containerized | bool -- name: remove all containers and images +- name: Remove all containers and images script: nuke_images.sh docker register: nuke_images_result - when: docker_upgrade is defined and docker_upgrade | bool + when: docker_upgrade | bool and docker_upgrade_nuke_images is defined and docker_upgrade_nuke_images | bool -# todo: should we use the docker role to actually do the upgrade? -- name: upgrade to specified docker version +- name: Upgrade Docker action: "{{ ansible_pkg_mgr }} name=docker{{ '-' + docker_version }} state=present" - register: docker_upgrade_result - when: docker_upgrade is defined and docker_upgrade | bool and docker_version is defined + when: docker_upgrade | bool -- name: upgrade to latest docker version - action: "{{ ansible_pkg_mgr }} name=docker state=latest" - register: docker_upgrade_result - when: docker_upgrade is defined and docker_upgrade | bool and docker_version is not defined - -- name: restart containerized services +- name: Restart containerized services service: name={{ item }} state=started with_items: - etcd_container @@ -39,9 +32,9 @@ - "{{ openshift.common.service_type }}-master-controllers" - "{{ openshift.common.service_type }}-node" failed_when: false - when: docker_upgrade is defined and docker_upgrade | bool and openshift.common.is_containerized | bool + when: docker_upgrade | bool and openshift.common.is_containerized | bool -- name: wait for master api to come back online +- name: Wait for master API to come back online become: no local_action: module: wait_for @@ -49,4 +42,4 @@ state=started delay=10 port="{{ openshift.master.api_port }}" - when: docker_upgrade is defined and docker_upgrade | bool and inventory_hostname in groups.oo_masters_to_config + when: docker_upgrade | bool and inventory_hostname in groups.oo_masters_to_config -- cgit v1.2.3 From f004b526078b78b0ba9435b82af4d4f4d42de5e2 Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Mon, 27 Jun 2016 15:44:04 -0300 Subject: More docker upgrade fixes. --- playbooks/common/openshift-cluster/upgrades/docker/upgrade.yml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'playbooks/common/openshift-cluster/upgrades/docker/upgrade.yml') diff --git a/playbooks/common/openshift-cluster/upgrades/docker/upgrade.yml b/playbooks/common/openshift-cluster/upgrades/docker/upgrade.yml index 81db9ef20..20d66522f 100644 --- a/playbooks/common/openshift-cluster/upgrades/docker/upgrade.yml +++ b/playbooks/common/openshift-cluster/upgrades/docker/upgrade.yml @@ -11,16 +11,15 @@ - etcd_container - openvswitch failed_when: false - when: docker_upgrade | bool and openshift.common.is_containerized | bool + when: openshift.common.is_containerized | bool - name: Remove all containers and images script: nuke_images.sh docker register: nuke_images_result - when: docker_upgrade | bool and docker_upgrade_nuke_images is defined and docker_upgrade_nuke_images | bool + when: docker_upgrade_nuke_images is defined and docker_upgrade_nuke_images | bool - name: Upgrade Docker action: "{{ ansible_pkg_mgr }} name=docker{{ '-' + docker_version }} state=present" - when: docker_upgrade | bool - name: Restart containerized services service: name={{ item }} state=started @@ -32,7 +31,7 @@ - "{{ openshift.common.service_type }}-master-controllers" - "{{ openshift.common.service_type }}-node" failed_when: false - when: docker_upgrade | bool and openshift.common.is_containerized | bool + when: openshift.common.is_containerized | bool - name: Wait for master API to come back online become: no @@ -42,4 +41,4 @@ state=started delay=10 port="{{ openshift.master.api_port }}" - when: docker_upgrade | bool and inventory_hostname in groups.oo_masters_to_config + when: inventory_hostname in groups.oo_masters_to_config -- cgit v1.2.3