From 7197aba51d24ab2cf6cde77efa853903d7ddd5ba Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Wed, 28 Oct 2015 12:12:39 -0300 Subject: Block upgrade if targetting enterprise deployment type. enterprise is being phased out in favor of openshift-enterprise, you need to specify where you wish to go. --- playbooks/adhoc/upgrades/upgrade.yml | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'playbooks') diff --git a/playbooks/adhoc/upgrades/upgrade.yml b/playbooks/adhoc/upgrades/upgrade.yml index 56a1df860..e8d6a335d 100644 --- a/playbooks/adhoc/upgrades/upgrade.yml +++ b/playbooks/adhoc/upgrades/upgrade.yml @@ -1,4 +1,12 @@ --- +- name: Verify deployment type + hosts: masters + tasks: + # Checking the global deployment type rather than host facts, this is about + # what the user is requesting. + - fail: msg="Deployment type enterprise not supported for upgrade" + when: deployment_type == "enterprise" + - name: Re-Run cluster configuration to apply latest configuration changes include: ../../common/openshift-cluster/config.yml vars: -- cgit v1.2.3 From 3d7c5c6fd545112d87fa09e4a8c3f3cbc1cda1ee Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Wed, 28 Oct 2015 15:29:52 -0300 Subject: First cut at checking available disk space for etcd backup. --- playbooks/adhoc/upgrades/upgrade.yml | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) (limited to 'playbooks') diff --git a/playbooks/adhoc/upgrades/upgrade.yml b/playbooks/adhoc/upgrades/upgrade.yml index e8d6a335d..c2c1d57e8 100644 --- a/playbooks/adhoc/upgrades/upgrade.yml +++ b/playbooks/adhoc/upgrades/upgrade.yml @@ -1,5 +1,5 @@ --- -- name: Verify deployment type +- name: Verify upgrade can proceed hosts: masters tasks: # Checking the global deployment type rather than host facts, this is about @@ -7,6 +7,31 @@ - fail: msg="Deployment type enterprise not supported for upgrade" when: deployment_type == "enterprise" +- name: Backup etcd + hosts: masters + vars: + embedded_etcd: "{{ openshift.master.embedded_etcd }}" + roles: + - openshift_facts + tasks: + - name: display all variables set for the current host + debug: + var: hostvars[inventory_hostname] + - debug: var=embedded_etcd + - name: Check available data dir disk space + shell: > + df --output=avail -k {{ openshift.common.data_dir }} | tail -n 1 + register: avail_disk + when: embedded_etcd | bool + - debug: var=avail_disk.stdout + - name: Check current etcd disk usage + shell: > + df --output=avail -k /var/lib/openshift/openshift.local.etcd/ | tail -n 1 + register: etc_disk_usage + when: embedded_etcd | bool + - debug: var=etc_disk_usage.stdout + - fail: msg="All done for now." + - name: Re-Run cluster configuration to apply latest configuration changes include: ../../common/openshift-cluster/config.yml vars: -- cgit v1.2.3 From 18df191a381ced63613dea302c5bf2e172d3c803 Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Thu, 29 Oct 2015 15:07:42 -0300 Subject: Functional disk space checking for etcd backup. --- playbooks/adhoc/upgrades/upgrade.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'playbooks') diff --git a/playbooks/adhoc/upgrades/upgrade.yml b/playbooks/adhoc/upgrades/upgrade.yml index c2c1d57e8..ec0eca66c 100644 --- a/playbooks/adhoc/upgrades/upgrade.yml +++ b/playbooks/adhoc/upgrades/upgrade.yml @@ -26,10 +26,13 @@ - debug: var=avail_disk.stdout - name: Check current etcd disk usage shell: > - df --output=avail -k /var/lib/openshift/openshift.local.etcd/ | tail -n 1 + du -k {{ openshift.common.data_dir }}/openshift.local.etcd | tail -n 1 | cut -f1 register: etc_disk_usage when: embedded_etcd | bool - debug: var=etc_disk_usage.stdout + - name: Abort if insufficient disk space for etcd backup + fail: msg="{{ etc_disk_usage.stdout }} Kb disk space required for etcd backup, {{ avail_disk.stdout }} Kb available." + when: (embedded_etcd | bool) and (etc_disk_usage.stdout|int > avail_disk.stdout|int) - fail: msg="All done for now." - name: Re-Run cluster configuration to apply latest configuration changes -- cgit v1.2.3 From ef2e4fc1fa247ba51394766f9cf9279f0beaf0b0 Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Fri, 30 Oct 2015 09:02:26 -0300 Subject: Add etcd_data_dir fact. --- playbooks/adhoc/upgrades/upgrade.yml | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) (limited to 'playbooks') diff --git a/playbooks/adhoc/upgrades/upgrade.yml b/playbooks/adhoc/upgrades/upgrade.yml index ec0eca66c..948a320a2 100644 --- a/playbooks/adhoc/upgrades/upgrade.yml +++ b/playbooks/adhoc/upgrades/upgrade.yml @@ -14,25 +14,26 @@ roles: - openshift_facts tasks: - - name: display all variables set for the current host - debug: - var: hostvars[inventory_hostname] - - debug: var=embedded_etcd - - name: Check available data dir disk space + - debug: var=etcd_data_dir + - name: Check available disk space for etcd backup + # We assume to be using the data dir for all backups. shell: > df --output=avail -k {{ openshift.common.data_dir }} | tail -n 1 register: avail_disk - when: embedded_etcd | bool - - debug: var=avail_disk.stdout - - name: Check current etcd disk usage + + - name: Check current embedded etcd disk usage shell: > - du -k {{ openshift.common.data_dir }}/openshift.local.etcd | tail -n 1 | cut -f1 - register: etc_disk_usage + du -k {{ openshift.master.etcd_data_dir }} | tail -n 1 | cut -f1 + register: etcd_disk_usage when: embedded_etcd | bool - - debug: var=etc_disk_usage.stdout + - name: Abort if insufficient disk space for etcd backup - fail: msg="{{ etc_disk_usage.stdout }} Kb disk space required for etcd backup, {{ avail_disk.stdout }} Kb available." - when: (embedded_etcd | bool) and (etc_disk_usage.stdout|int > avail_disk.stdout|int) + fail: msg="{{ etcd_disk_usage.stdout }} Kb disk space required for etcd backup, {{ avail_disk.stdout }} Kb available." + when: (embedded_etcd | bool) and (etcd_disk_usage.stdout|int > avail_disk.stdout|int) + - name: Install etcd (for etcdctl) + yum: pkg=etcd state=latest + - name: Generate etcd backup + command: etcdctl backup - fail: msg="All done for now." - name: Re-Run cluster configuration to apply latest configuration changes -- cgit v1.2.3 From 561c347d54c3a124f64b54eedbf6d2d56fb07c34 Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Fri, 30 Oct 2015 09:41:12 -0300 Subject: Generate timestamped etcd backups. --- playbooks/adhoc/upgrades/upgrade.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'playbooks') diff --git a/playbooks/adhoc/upgrades/upgrade.yml b/playbooks/adhoc/upgrades/upgrade.yml index 948a320a2..11d89a3da 100644 --- a/playbooks/adhoc/upgrades/upgrade.yml +++ b/playbooks/adhoc/upgrades/upgrade.yml @@ -11,10 +11,10 @@ hosts: masters vars: embedded_etcd: "{{ openshift.master.embedded_etcd }}" + timestamp: "{{ lookup('pipe', 'date +%Y%m%d%H%M%S') }}" roles: - openshift_facts tasks: - - debug: var=etcd_data_dir - name: Check available disk space for etcd backup # We assume to be using the data dir for all backups. shell: > @@ -33,7 +33,7 @@ - name: Install etcd (for etcdctl) yum: pkg=etcd state=latest - name: Generate etcd backup - command: etcdctl backup + command: etcdctl backup --data-dir={{ openshift.master.etcd_data_dir }} --backup-dir={{ openshift.common.data_dir }}/etcd-backup-{{ timestamp }} - fail: msg="All done for now." - name: Re-Run cluster configuration to apply latest configuration changes -- cgit v1.2.3 From 83e20a43c7b7e6876a7828d02b7fc96b8c8bbf38 Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Fri, 30 Oct 2015 11:20:44 -0300 Subject: Remove devel fail and let upgrade proceed. --- playbooks/adhoc/upgrades/upgrade.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'playbooks') diff --git a/playbooks/adhoc/upgrades/upgrade.yml b/playbooks/adhoc/upgrades/upgrade.yml index 11d89a3da..30896dc8e 100644 --- a/playbooks/adhoc/upgrades/upgrade.yml +++ b/playbooks/adhoc/upgrades/upgrade.yml @@ -34,7 +34,6 @@ yum: pkg=etcd state=latest - name: Generate etcd backup command: etcdctl backup --data-dir={{ openshift.master.etcd_data_dir }} --backup-dir={{ openshift.common.data_dir }}/etcd-backup-{{ timestamp }} - - fail: msg="All done for now." - name: Re-Run cluster configuration to apply latest configuration changes include: ../../common/openshift-cluster/config.yml @@ -50,6 +49,8 @@ vars: openshift_version: "{{ openshift_pkg_version | default('') }}" tasks: + - name: Upgrade to latest available kernel + yum: pkg=kernel state=latest - name: Upgrade master packages yum: pkg={{ openshift.common.service_type }}-master{{ openshift_version }} state=latest - name: Restart master services -- cgit v1.2.3 From 866dcbe962464a571f24e1e4ae5a9e928f7bbc47 Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Mon, 2 Nov 2015 13:14:26 -0400 Subject: Fix etcd backup bug with not-yet-created /var/lib/origin symlink --- playbooks/adhoc/upgrades/upgrade.yml | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'playbooks') diff --git a/playbooks/adhoc/upgrades/upgrade.yml b/playbooks/adhoc/upgrades/upgrade.yml index 30896dc8e..c543a4416 100644 --- a/playbooks/adhoc/upgrades/upgrade.yml +++ b/playbooks/adhoc/upgrades/upgrade.yml @@ -15,6 +15,11 @@ roles: - openshift_facts tasks: + - stat: path=/var/lib/openshift + register: var_lib_openshift + - name: Create origin symlink if necessary + file: src=/var/lib/openshift/ dest=/var/lib/origin state=link + when: var_lib_openshift.stat.exists == True - name: Check available disk space for etcd backup # We assume to be using the data dir for all backups. shell: > -- cgit v1.2.3