Manage grains using support metadata

Change-Id: I300553e799d4aeaabd76610b922ee5df2de92fd7
diff --git a/backupninja/client.sls b/backupninja/client.sls
index 7824658..7760800 100644
--- a/backupninja/client.sls
+++ b/backupninja/client.sls
@@ -71,23 +71,6 @@
 {%- endfor %}
 {%- endfor %}
 
-backupninja_client_grains_dir:
-  file.directory:
-  - name: /etc/salt/grains.d
-  - mode: 700
-  - makedirs: true
-  - user: root
-
-backupninja_client_grain:
-  file.managed:
-  - name: /etc/salt/grains.d/backupninja
-  - source: salt://backupninja/files/backupninja.grain
-  - template: jinja
-  - user: root
-  - mode: 600
-  - require:
-    - file: backupninja_client_grains_dir
-
 {%- if client.target is defined %}
 
 {%- if client.target.engine in ["s3","dup",] %}
diff --git a/backupninja/files/backupninja.grain b/backupninja/files/backupninja.grain
deleted file mode 100644
index 6345ff0..0000000
--- a/backupninja/files/backupninja.grain
+++ /dev/null
@@ -1,2 +0,0 @@
-{%- from "backupninja/map.jinja" import service_grains with context -%}
-{{ service_grains|yaml(False) }}
diff --git a/backupninja/meta/salt.yml b/backupninja/meta/salt.yml
new file mode 100644
index 0000000..c60274b
--- /dev/null
+++ b/backupninja/meta/salt.yml
@@ -0,0 +1,6 @@
+grain:
+  backupninja:
+    {%- if pillar.backupninja.client is defined %}
+    {%- from "backupninja/map.jinja" import service_grains with context %}
+    {{ service_grains|yaml(False)|indent(4) }}
+    {%- endif %}