summaryrefslogtreecommitdiffstats
path: root/roles/etcd_common/tasks
diff options
context:
space:
mode:
authorScott Dodson <sdodson@redhat.com>2017-06-29 22:38:55 -0400
committerGitHub <noreply@github.com>2017-06-29 22:38:55 -0400
commitbad62a990ecb5beff71d37176c6a46ae7759f5fd (patch)
tree566c7612c0b0003b2f4132081e2e4c21dafdc239 /roles/etcd_common/tasks
parent5783c0713ca689b20ba3b64b8d6525b57cc3fd5d (diff)
parent95d94f1e7611d5763022b1c6fe15f26fa6445055 (diff)
downloadopenshift-bad62a990ecb5beff71d37176c6a46ae7759f5fd.tar.gz
openshift-bad62a990ecb5beff71d37176c6a46ae7759f5fd.tar.bz2
openshift-bad62a990ecb5beff71d37176c6a46ae7759f5fd.tar.xz
openshift-bad62a990ecb5beff71d37176c6a46ae7759f5fd.zip
Merge pull request #4640 from ingvagabund/fix-backup-and-workdir-dir-paths-for-etcd-system-container
fix backup and working directory for etcd run as a system container
Diffstat (limited to 'roles/etcd_common/tasks')
-rw-r--r--roles/etcd_common/tasks/backup.yml23
1 files changed, 16 insertions, 7 deletions
diff --git a/roles/etcd_common/tasks/backup.yml b/roles/etcd_common/tasks/backup.yml
index 4a4832275..2384eeb58 100644
--- a/roles/etcd_common/tasks/backup.yml
+++ b/roles/etcd_common/tasks/backup.yml
@@ -1,10 +1,19 @@
---
- set_fact:
- l_etcd_backup_dir: "{{ etcd_data_dir }}/openshift-backup-{{ r_etcd_common_backup_tag }}{{ r_etcd_common_backup_sufix_name }}"
+ l_etcd_data_dir: "{{ etcd_data_dir }}{{ '/etcd.etcd' if r_etcd_common_etcd_runtime == 'runc' else '' }}"
+
+- set_fact:
+ l_etcd_incontainer_data_dir: "{{ etcd_data_dir }}"
+
+- set_fact:
+ l_etcd_incontainer_backup_dir: "{{ l_etcd_incontainer_data_dir }}/openshift-backup-{{ r_etcd_common_backup_tag }}{{ r_etcd_common_backup_sufix_name }}"
+
+- set_fact:
+ l_etcd_backup_dir: "{{ l_etcd_data_dir }}/openshift-backup-{{ r_etcd_common_backup_tag }}{{ r_etcd_common_backup_sufix_name }}"
# TODO: replace shell module with command and update later checks
- name: Check available disk space for etcd backup
- shell: df --output=avail -k {{ etcd_data_dir }} | tail -n 1
+ shell: df --output=avail -k {{ l_etcd_data_dir }} | tail -n 1
register: l_avail_disk
# AUDIT:changed_when: `false` because we are only inspecting
# state, not manipulating anything
@@ -12,7 +21,7 @@
# TODO: replace shell module with command and update later checks
- name: Check current etcd disk usage
- shell: du --exclude='*openshift-backup*' -k {{ etcd_data_dir }} | tail -n 1 | cut -f1
+ shell: du --exclude='*openshift-backup*' -k {{ l_etcd_data_dir }} | tail -n 1 | cut -f1
register: l_etcd_disk_usage
when: r_etcd_common_embedded_etcd | bool
# AUDIT:changed_when: `false` because we are only inspecting
@@ -48,19 +57,19 @@
- name: Generate etcd backup
command: >
- {{ r_etcd_common_etcdctl_command }} backup --data-dir={{ etcd_data_dir }}
- --backup-dir={{ l_etcd_backup_dir }}
+ {{ r_etcd_common_etcdctl_command }} backup --data-dir={{ l_etcd_incontainer_data_dir }}
+ --backup-dir={{ l_etcd_incontainer_backup_dir }}
# 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: "{{ etcd_data_dir }}/member/snap/db"
+ path: "{{ l_etcd_data_dir }}/member/snap/db"
register: l_v3_db
- name: Copy etcd v3 data store
command: >
- cp -a {{ etcd_data_dir }}/member/snap/db
+ cp -a {{ l_etcd_data_dir }}/member/snap/db
{{ l_etcd_backup_dir }}/member/snap/
when: l_v3_db.stat.exists