From ce10e598407d94e2b396b2aa9da5b5c33a0f4ee8 Mon Sep 17 00:00:00 2001 From: Jan Chaloupka Date: Fri, 30 Jun 2017 12:19:09 +0200 Subject: evalute etcd backup directory name only once --- roles/etcd_common/tasks/backup.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'roles/etcd_common/tasks') diff --git a/roles/etcd_common/tasks/backup.yml b/roles/etcd_common/tasks/backup.yml index 2384eeb58..1a0b857f1 100644 --- a/roles/etcd_common/tasks/backup.yml +++ b/roles/etcd_common/tasks/backup.yml @@ -1,4 +1,10 @@ --- +# set the etcd backup directory name here in case the tag or sufix consists of dynamic value that changes over time +# e.g. openshift-backup-{{ lookup('pipe', 'date +%Y%m%d%H%M%S') }} value will change every second so if the date changes +# right after setting l_etcd_incontainer_backup_dir and before l_etcd_backup_dir facts, the backup directory name is different +- set_fact: + l_backup_dir_name: "openshift-backup-{{ r_etcd_common_backup_tag }}{{ r_etcd_common_backup_sufix_name }}" + - set_fact: l_etcd_data_dir: "{{ etcd_data_dir }}{{ '/etcd.etcd' if r_etcd_common_etcd_runtime == 'runc' else '' }}" @@ -6,10 +12,10 @@ 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 }}" + l_etcd_incontainer_backup_dir: "{{ l_etcd_incontainer_data_dir }}/{{ l_backup_dir_name }}" - set_fact: - l_etcd_backup_dir: "{{ l_etcd_data_dir }}/openshift-backup-{{ r_etcd_common_backup_tag }}{{ r_etcd_common_backup_sufix_name }}" + l_etcd_backup_dir: "{{ l_etcd_data_dir }}/{{ l_backup_dir_name }}" # TODO: replace shell module with command and update later checks - name: Check available disk space for etcd backup -- cgit v1.2.3