2015-10-05 23:37:13 +00:00
|
|
|
.. _targeting-pillar:
|
|
|
|
|
2016-02-01 03:10:02 +00:00
|
|
|
======================
|
|
|
|
Targeting using Pillar
|
|
|
|
======================
|
2015-10-05 23:37:13 +00:00
|
|
|
|
|
|
|
Pillar data can be used when targeting minions. This allows for ultimate
|
|
|
|
control and flexibility when targeting minions.
|
|
|
|
|
2016-04-25 21:26:09 +00:00
|
|
|
.. note::
|
|
|
|
|
|
|
|
To start using Pillar targeting it is required to make a Pillar
|
|
|
|
data cache on Salt Master for each Minion via following commands:
|
|
|
|
``salt '*' saltutil.refresh_pillar`` or ``salt '*' saltutil.sync_all``.
|
|
|
|
Also Pillar data cache will be populated during the
|
|
|
|
:ref:`highstate <running-highstate>` run. Once Pillar data changes, you
|
|
|
|
must refresh the cache by running above commands for this targeting
|
|
|
|
method to work correctly.
|
|
|
|
|
|
|
|
Example:
|
|
|
|
|
2015-10-05 23:37:13 +00:00
|
|
|
.. code-block:: bash
|
|
|
|
|
2019-03-25 17:09:48 +00:00
|
|
|
salt -I 'somekey:specialvalue' test.version
|
2015-10-05 23:37:13 +00:00
|
|
|
|
|
|
|
Like with :ref:`Grains <targeting-grains>`, it is possible to use globbing
|
|
|
|
as well as match nested values in Pillar, by adding colons for each level that
|
|
|
|
is being traversed. The below example would match minions with a pillar named
|
|
|
|
``foo``, which is a dict containing a key ``bar``, with a value beginning with
|
|
|
|
``baz``:
|
|
|
|
|
|
|
|
.. code-block:: bash
|
|
|
|
|
2019-03-25 17:09:48 +00:00
|
|
|
salt -I 'foo:bar:baz*' test.version
|