From c46a19ad719efae03362b75865cdf8dbd747b4cb Mon Sep 17 00:00:00 2001
From: juanvallejo <jvallejo@redhat.com>
Date: Fri, 12 May 2017 17:30:11 -0400
Subject: check if hostname is in list of etcd hosts

---
 roles/openshift_health_checker/openshift_checks/etcd_volume.py | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

(limited to 'roles')

diff --git a/roles/openshift_health_checker/openshift_checks/etcd_volume.py b/roles/openshift_health_checker/openshift_checks/etcd_volume.py
index ad88ae44d..b742f7603 100644
--- a/roles/openshift_health_checker/openshift_checks/etcd_volume.py
+++ b/roles/openshift_health_checker/openshift_checks/etcd_volume.py
@@ -14,9 +14,10 @@ class EtcdVolume(OpenShiftCheck):
 
     @classmethod
     def is_active(cls, task_vars):
-        # TODO: only execute this check on hosts in the 'ectd' group?
-        # Maybe also 'masters' if there are no standalone etcd hosts?
-        return super(EtcdVolume, cls).is_active(task_vars)
+        etcd_hosts = get_var(task_vars, "groups", "etcd", default=[]) or get_var(task_vars, "groups", "masters",
+                                                                                 default=[]) or []
+        is_etcd_host = get_var(task_vars, "ansible_ssh_host") in etcd_hosts
+        return super(EtcdVolume, cls).is_active(task_vars) and is_etcd_host
 
     def run(self, tmp, task_vars):
         mount_info = self._etcd_mount_info(task_vars)
-- 
cgit v1.2.3