summaryrefslogtreecommitdiffstats
path: root/playbooks/common/openshift-cluster/upgrades/etcd/containerized_tasks.yml
diff options
context:
space:
mode:
Diffstat (limited to 'playbooks/common/openshift-cluster/upgrades/etcd/containerized_tasks.yml')
-rw-r--r--playbooks/common/openshift-cluster/upgrades/etcd/containerized_tasks.yml24
1 files changed, 16 insertions, 8 deletions
diff --git a/playbooks/common/openshift-cluster/upgrades/etcd/containerized_tasks.yml b/playbooks/common/openshift-cluster/upgrades/etcd/containerized_tasks.yml
index 2cbe3b729..9ace7db25 100644
--- a/playbooks/common/openshift-cluster/upgrades/etcd/containerized_tasks.yml
+++ b/playbooks/common/openshift-cluster/upgrades/etcd/containerized_tasks.yml
@@ -2,13 +2,14 @@
- name: Verify cluster is healthy pre-upgrade
command: "etcdctl --cert-file /etc/etcd/peer.crt --key-file /etc/etcd/peer.key --ca-file /etc/etcd/ca.crt -C https://{{ openshift.common.hostname }}:2379 cluster-health"
-- name: Update systemd unit
- openshift_facts:
- role: etcd
+- name: Get current image
+ shell: grep 'ExecStart=' /etc/systemd/system/etcd_container.service | awk '{print $NF}'
+ register: current_image
-- name: Set etcd3 image name
+- name: Set new_etcd_image
set_fact:
- new_etcd_image: "{{ openshift.etcd.etcd_image | regex_replace('/etcd$','/etcd3') }}"
+ new_etcd_image: "{{ current_image.stdout | regex_replace('/etcd.*$','/etcd3:' ~ upgrade_version ) if upgrade_version | version_compare('3.0','>=')
+ else current_image.stdout.split(':')[0] ~ ':' ~ upgrade_version }}"
- name: Pull new etcd image
command: "docker pull {{ new_etcd_image }}"
@@ -16,15 +17,22 @@
- name: Update to latest etcd image
replace:
dest: /etc/systemd/system/etcd_container.service
- regexp: "{{ openshift.etcd.etcd_image }}$"
+ regexp: "{{ current_image.stdout }}$"
replace: "{{ new_etcd_image }}"
-- name: Update etcd package not excluding etcd3
+- name: Restart etcd_container
systemd:
name: etcd_container
daemon_reload: yes
state: restarted
+## TODO: probably should just move this into the backup playbooks, also this
+## will fail on atomic host. We need to revisit how to do etcd backups there as
+## the container may be newer than etcdctl on the host. Assumes etcd3 obsoletes etcd (7.3.1)
+- name: Upgrade etcdctl to 3.0 if necessary and able
+ action: "{{ ansible_pkg_mgr }} name=etcd ensure=latest"
+ when: openshift.common.is_containerized | bool and not openshift.common.is_atomic | bool and upgrade_version | version_compare('3.0','>=')
+
- name: Verify cluster is healthy
command: "etcdctl --cert-file /etc/etcd/peer.crt --key-file /etc/etcd/peer.key --ca-file /etc/etcd/ca.crt -C https://{{ openshift.common.hostname }}:2379 cluster-health"
register: etcdctl
@@ -36,4 +44,4 @@
openshift_facts:
role: etcd
local_facts:
- - etcd_image: "{{ new_etcd_image }}"
+ etcd_image: "{{ new_etcd_image }}"