With Salt there is a whole host of ways to target minions. In most cases I prefer to target minions based on certain grains.
$ salt -G 'role:webserver' test.ping
However, this allows you to only target minions by a single grain. In order to target minions based on multiple grains you use compound matchers.
$ salt -C 'G@role:webserver and G@role:worker' test.ping
See the salt docs for more information about compound matchers.
You may combine these compound expressions to define node groups in the configuration of the salt-master. This configuration is a YAML file which is by default located at
/etc/salt/master, on the salt-master obviously.
An node group definition in the master configuration would look like the following for example:
nodegroups: django: 'G@role:webserver and G@role:worker'
By defining this
django node group you can target all the matching minions with the following command:
$ salt -N django test.ping