Fix reshuffle ids during crush map generation
 - add support for fixed crush_id for buckets
 - start reusing existing id for hosts

Related-Prod: PROD-36797
Change-Id: Ic84626027f5c329ec833280cf5b409284171ae89
diff --git a/_grains/ceph.py b/_grains/ceph.py
index e9f38a6..f080377 100644
--- a/_grains/ceph.py
+++ b/_grains/ceph.py
@@ -26,6 +26,12 @@
                     attr = shlex.split(line)
                     grain['ceph']['fsid'] = attr[2]
 
+        # crush id
+        cmd = "ceph osd crush tree | grep `hostname -s` | awk '{print $1}'"
+        crush_id = check_output(cmd, shell=True).strip()
+        if crush_id:
+            grain['ceph']['crush_id'] = crush_id
+
         # osd
         if os.path.exists('/var/lib/ceph/osd'):
             devices = {}