Browse Source

use etcdctl from the container when containerized=True

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
Giuseppe Scrivano 8 years ago
parent
commit
51ccdc2467
1 changed files with 2 additions and 1 deletions
  1. 2 1
      playbooks/common/openshift-cluster/upgrades/etcd/backup.yml

+ 2 - 1
playbooks/common/openshift-cluster/upgrades/etcd/backup.yml

@@ -3,6 +3,7 @@
   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' }}"
   roles:
   - openshift_facts
   tasks:
@@ -47,7 +48,7 @@
 
   - name: Generate etcd backup
     command: >
-      etcdctl backup --data-dir={{ openshift.etcd.etcd_data_dir }}
+      {{ etcdctl_command }} backup --data-dir={{ openshift.etcd.etcd_data_dir }}
       --backup-dir={{ openshift.common.data_dir }}/etcd-backup-{{ backup_tag | default('') }}{{ timestamp }}
 
   - set_fact: