Thursday, 28 September 2017

SaltStack Targeting Methods - List Matching

This could possibly be the shortest tutorial in this series. We have been dealing with targeting minions and different methods to target minions. We have covered a couple of methods of targeting minions - with glob matching and PCRE matching, in previous tutorials. In this one, we will learn about another methods i.e. using list matching and believe me, it's the simplest one.


This method does not require any fancy stuff to match minion IDs, like we saw in case of previous cases. We just provide a list of minions to the salt command, that we wish to manage. List is a comma separated sequence of minions. In order to process the list on minions, we use the option -L or --list with salt command. Remember, till now, we have created only two minions - centos-rack1 and redhat-rack2.

$ salt -L 'centos-rack1' test.ping
centos-rack1:
    True
 

$ salt -L 'centos-rack1,redhat-rack2,ubuntu-rack1' test.ping
redhat-rack2:
    True
centos-rack1:
    True
 

$ salt -L 'ubuntu-rack1' test.ping
No minions matched the target. No command was sent, no jid was assigned.
ERROR: No return received

0 comments:

Post a Comment