diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2017-09-25 08:11:44 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-09-25 08:11:44 -0700 |
commit | 67ff061a940a4b9dce6686b8a00a3eb52aeeb698 (patch) | |
tree | 0c5fb80ab97cf0762a496a798c05ff85067178af /roles/etcd | |
parent | c390d382a2c1783964179490eec810ee2206fa32 (diff) | |
parent | 2c8d16c36b8eec5c2a82fb5da7291736654e55f2 (diff) | |
download | openshift-67ff061a940a4b9dce6686b8a00a3eb52aeeb698.tar.gz openshift-67ff061a940a4b9dce6686b8a00a3eb52aeeb698.tar.bz2 openshift-67ff061a940a4b9dce6686b8a00a3eb52aeeb698.tar.xz openshift-67ff061a940a4b9dce6686b8a00a3eb52aeeb698.zip |
Merge pull request #5451 from ingvagabund/consolidate-etcd-upgrade
Automatic merge from submit-queue
Consolidate etcd upgrade
Consolidates `etcd_upgrade` into the `etcd` role.
Diffstat (limited to 'roles/etcd')
-rw-r--r-- | roles/etcd/tasks/upgrade/upgrade_image.yml | 55 | ||||
-rw-r--r-- | roles/etcd/tasks/upgrade/upgrade_rpm.yml | 32 | ||||
-rw-r--r-- | roles/etcd/tasks/upgrade_image.yml | 2 | ||||
-rw-r--r-- | roles/etcd/tasks/upgrade_rpm.yml | 2 |
4 files changed, 91 insertions, 0 deletions
diff --git a/roles/etcd/tasks/upgrade/upgrade_image.yml b/roles/etcd/tasks/upgrade/upgrade_image.yml new file mode 100644 index 000000000..cea95a1b3 --- /dev/null +++ b/roles/etcd/tasks/upgrade/upgrade_image.yml @@ -0,0 +1,55 @@ +--- +# INPUT r_etcd_upgrade_version +- name: Verify cluster is healthy pre-upgrade + command: "{{ etcdctlv2 }} cluster-health" + +- name: Get current image + shell: "grep 'ExecStart=' {{ etcd_service_file }} | awk '{print $NF}'" + register: current_image + +- name: Set new_etcd_image + set_fact: + new_etcd_image: "{{ current_image.stdout | regex_replace('/etcd.*$','/etcd:' ~ r_etcd_upgrade_version ) }}" + +- name: Pull new etcd image + command: "docker pull {{ new_etcd_image }}" + +- name: Update to latest etcd image + replace: + dest: "{{ etcd_service_file }}" + regexp: "{{ current_image.stdout }}$" + replace: "{{ new_etcd_image }}" + +- name: Restart etcd_container + systemd: + name: "{{ etcd_service }}" + 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: Detecting Atomic Host Operating System + stat: + path: /run/ostree-booted + register: l_ostree_booted + +- name: Upgrade etcd for etcdctl when not atomic + package: + name: etcd + state: latest + when: not l_ostree_booted.stat.exists | bool + +- name: Verify cluster is healthy + command: "{{ etcdctlv2 }} cluster-health" + register: etcdctl + until: etcdctl.rc == 0 + retries: 3 + delay: 10 + +- name: Store new etcd_image + # DEPENDENCY openshift_facts + openshift_facts: + role: etcd + local_facts: + etcd_image: "{{ new_etcd_image }}" diff --git a/roles/etcd/tasks/upgrade/upgrade_rpm.yml b/roles/etcd/tasks/upgrade/upgrade_rpm.yml new file mode 100644 index 000000000..324b69605 --- /dev/null +++ b/roles/etcd/tasks/upgrade/upgrade_rpm.yml @@ -0,0 +1,32 @@ +--- +# INPUT r_etcd_upgrade_version? + +# F23 GA'd with etcd 2.0, currently has 2.2 in updates +# F24 GA'd with etcd-2.2, currently has 2.2 in updates +# F25 Beta currently has etcd 3.0 +# RHEL 7.3.4 with etcd-3.1.3-1.el7 +# RHEL 7.3.3 with etcd-3.1.0-2.el7 +# RHEL 7.3.2 with etcd-3.0.15-1.el7 + +- name: Verify cluster is healthy pre-upgrade + command: "{{ etcdctlv2 }} cluster-health" + +- set_fact: + l_etcd_target_package: "{{ 'etcd' if r_etcd_upgrade_version is not defined else 'etcd-'+r_etcd_upgrade_version+'*' }}" + +- name: Update etcd RPM to {{ l_etcd_target_package }} + package: + name: "{{ l_etcd_target_package }}" + state: latest + +- name: Restart etcd + service: + name: "{{ etcd_service }}" + state: restarted + +- name: Verify cluster is healthy + command: "{{ etcdctlv2 }} cluster-health" + register: etcdctl + until: etcdctl.rc == 0 + retries: 3 + delay: 10 diff --git a/roles/etcd/tasks/upgrade_image.yml b/roles/etcd/tasks/upgrade_image.yml new file mode 100644 index 000000000..9e69027eb --- /dev/null +++ b/roles/etcd/tasks/upgrade_image.yml @@ -0,0 +1,2 @@ +--- +- include: upgrade/upgrade_image.yml diff --git a/roles/etcd/tasks/upgrade_rpm.yml b/roles/etcd/tasks/upgrade_rpm.yml new file mode 100644 index 000000000..29603d2b6 --- /dev/null +++ b/roles/etcd/tasks/upgrade_rpm.yml @@ -0,0 +1,2 @@ +--- +- include: upgrade/upgrade_rpm.yml |