@@ -50,6 +50,7 @@ Grains data can be listed by using the 'grains.items' module::
50
50
51
51
salt '*' grains.items
52
52
53
+
53
54
Grains in the Minion Config
54
55
===========================
55
56
@@ -70,6 +71,31 @@ Then status data specific to your servers can be retrieved via Salt, or used
70
71
inside of the State system for matching. It also makes targeting, in the case
71
72
of the example above, simply based on specific data about your deployment.
72
73
74
+
75
+ Grains in /etc/salt/grains
76
+ ==========================
77
+
78
+ If you do not want to place your custom static grains in the minion config
79
+ file, you can also put them in ``/etc/salt/grains ``. They are configured in the
80
+ same way as in the above example, only without a top-level ``grains: `` key:
81
+
82
+ .. code-block :: yaml
83
+
84
+ roles :
85
+ - webserver
86
+ - memcache
87
+ deployment : datacenter4
88
+ cabinet : 13
89
+ cab_u : 14-15
90
+
91
+ .. admonition :: Precedece of Custom Static Grains
92
+
93
+ Be careful when defining grains both in ``/etc/salt/grains `` and within the
94
+ minion config file. If a grain is defined in both places, the value in the
95
+ minion config file takes precedence, and will always be used over its
96
+ counterpart in ``/etc/salt/grains ``.
97
+
98
+
73
99
Writing Grains
74
100
==============
75
101
@@ -92,6 +118,7 @@ change, consider using :doc:`Pillar <../pillar/index>` instead.
92
118
93
119
.. _`dict` : http://docs.python.org/library/stdtypes.html#typesmapping
94
120
121
+
95
122
Examples of Grains
96
123
------------------
97
124
@@ -100,6 +127,7 @@ the Salt minion and provides the principal example of how to write grains:
100
127
101
128
:blob: `salt/grains/core.py `
102
129
130
+
103
131
Syncing Grains
104
132
--------------
105
133
0 commit comments