2014-02-27 21:36:13 +00:00
|
|
|
.. _targeting-nodegroups:
|
|
|
|
|
2012-02-20 06:28:45 +00:00
|
|
|
===========
|
|
|
|
Node groups
|
|
|
|
===========
|
|
|
|
|
2013-03-18 19:59:27 +00:00
|
|
|
Nodegroups are declared using a compound target specification. The compound
|
2013-08-11 02:55:51 +00:00
|
|
|
target documentation can be found :doc:`here <compound>`.
|
2012-08-01 17:11:40 +00:00
|
|
|
|
2013-08-11 02:55:51 +00:00
|
|
|
The :conf_master:`nodegroups` master config file parameter is used to define
|
2013-11-07 04:50:13 +00:00
|
|
|
nodegroups. Here's an example nodegroup configuration within
|
|
|
|
``/etc/salt/master``:
|
2012-08-01 17:11:40 +00:00
|
|
|
|
2013-08-11 02:55:51 +00:00
|
|
|
.. code-block:: yaml
|
2012-02-20 06:28:45 +00:00
|
|
|
|
|
|
|
nodegroups:
|
2012-12-03 23:21:15 +00:00
|
|
|
group1: 'L@foo.domain.com,bar.domain.com,baz.domain.com or bl*.domain.com'
|
2012-02-20 06:28:45 +00:00
|
|
|
group2: 'G@os:Debian and foo.domain.com'
|
|
|
|
|
2013-11-07 04:50:13 +00:00
|
|
|
.. note::
|
|
|
|
|
2014-02-23 18:19:10 +00:00
|
|
|
The ``L`` within group1 is matching a list of minions, while the ``G`` in
|
|
|
|
group2 is matching specific grains. See the :doc:`compound matchers
|
|
|
|
<compound>` documentation for more details.
|
2013-11-07 04:50:13 +00:00
|
|
|
|
2013-08-11 02:55:51 +00:00
|
|
|
To match a nodegroup on the CLI, use the ``-N`` command-line option:
|
|
|
|
|
|
|
|
.. code-block:: bash
|
2012-02-20 06:28:45 +00:00
|
|
|
|
|
|
|
salt -N group1 test.ping
|
|
|
|
|
2014-02-23 18:19:10 +00:00
|
|
|
To match a nodegroup in your :term:`top file`, make sure to put ``- match:
|
|
|
|
nodegroup`` on the line directly following the nodegroup name.
|
2013-08-11 02:55:51 +00:00
|
|
|
|
|
|
|
.. code-block:: yaml
|
2012-02-20 06:28:45 +00:00
|
|
|
|
|
|
|
base:
|
|
|
|
group1:
|
|
|
|
- match: nodegroup
|
|
|
|
- webserver
|
2014-04-14 15:39:31 +00:00
|
|
|
|
|
|
|
.. note::
|
|
|
|
|
|
|
|
When adding or modifying nodegroups to a master configuration file, the master must be restarted
|
2014-12-11 15:51:43 +00:00
|
|
|
for those changes to be fully recognized.
|
2014-05-15 18:06:50 +00:00
|
|
|
|
|
|
|
A limited amount of functionality, such as targeting with -N from the command-line may be
|
2014-12-11 15:51:43 +00:00
|
|
|
available without a restart.
|