Add fsid to the grains and filter upon it.
This in order to support multiple ceph clusters with the same salt master.
diff --git a/_grains/ceph.py b/_grains/ceph.py
index ec568c9..45652e8 100644
--- a/_grains/ceph.py
+++ b/_grains/ceph.py
@@ -19,6 +19,13 @@
break
conf_file = conf_dir + cluster_name + '.conf'
+ # get the fsid from config file, for salt-formulas to filter on in case of multiple ceph clusters
+ with open(conf_file, 'r') as conf_fh:
+ for line in conf_fh.read().splitlines():
+ if 'fsid' in line:
+ attr = shlex.split(line)
+ grain['ceph']['fsid'] = attr[2]
+
# osd
if os.path.exists('/var/lib/ceph/osd'):
mount_path = check_output("df -h | awk '{print $6}' | grep ceph | grep -v lockbox | sed 's/-[0-9]*//g' | awk 'NR==1{print $1}'", shell=True).rstrip()