summaryrefslogtreecommitdiffstats
path: root/playbooks/common
diff options
context:
space:
mode:
authorScott Dodson <sdodson@redhat.com>2017-04-05 15:43:39 -0400
committerScott Dodson <sdodson@redhat.com>2017-04-05 15:45:07 -0400
commit483e58decb4daae9c355a5be8f090d1778133143 (patch)
treecffe524301c3bbd2dfb9dbad45d00f88df43202d /playbooks/common
parent9b0f2945ece3798ef48bb38a07fa98239a141d65 (diff)
downloadopenshift-483e58decb4daae9c355a5be8f090d1778133143.tar.gz
openshift-483e58decb4daae9c355a5be8f090d1778133143.tar.bz2
openshift-483e58decb4daae9c355a5be8f090d1778133143.tar.xz
openshift-483e58decb4daae9c355a5be8f090d1778133143.zip
Copy v3 data dir when performing backup
Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1433272
Diffstat (limited to 'playbooks/common')
-rw-r--r--playbooks/common/openshift-cluster/upgrades/etcd/backup.yml16
1 files changed, 15 insertions, 1 deletions
diff --git a/playbooks/common/openshift-cluster/upgrades/etcd/backup.yml b/playbooks/common/openshift-cluster/upgrades/etcd/backup.yml
index 7ef79afa9..347621a14 100644
--- a/playbooks/common/openshift-cluster/upgrades/etcd/backup.yml
+++ b/playbooks/common/openshift-cluster/upgrades/etcd/backup.yml
@@ -3,7 +3,6 @@
hosts: etcd_hosts_to_backup
vars:
embedded_etcd: "{{ groups.oo_etcd_to_config | default([]) | length == 0 }}"
- timestamp: "{{ lookup('pipe', 'date +%Y%m%d%H%M%S') }}"
etcdctl_command: "{{ 'etcdctl' if not openshift.common.is_containerized or embedded_etcd else 'docker exec etcd_container etcdctl' if not openshift.common.is_etcd_system_container else 'runc exec etcd etcdctl' }}"
roles:
- openshift_facts
@@ -13,6 +12,8 @@
role: etcd
local_facts: {}
when: "'etcd' not in openshift"
+ - set_fact:
+ timestamp: "{{ lookup('pipe', 'date +%Y%m%d%H%M%S') }}"
- stat: path=/var/lib/openshift
register: var_lib_openshift
@@ -77,6 +78,19 @@
{{ etcdctl_command }} backup --data-dir={{ openshift.etcd.etcd_data_dir }}
--backup-dir={{ openshift.common.data_dir }}/etcd-backup-{{ backup_tag | default('') }}{{ timestamp }}
+ # According to the docs change you can simply copy snap/db
+ # https://github.com/openshift/openshift-docs/commit/b38042de02d9780842dce95cfa0ef45d53b58bc6
+ - name: Check for v3 data store
+ stat:
+ path: "{{ openshift.etcd.etcd_data_dir }}/member/snap/db"
+ register: v3_db
+
+ - name: Copy etcd v3 data store
+ command: >
+ cp -a {{ openshift.etcd.etcd_data_dir }}/member/snap
+ {{ openshift.common.data_dir }}/etcd-backup-{{ backup_tag | default('') }}{{ timestamp }}/member/
+ when: v3_db.stat.exists
+
- set_fact:
etcd_backup_complete: True