Is there an easier way to get a list of minions that match a particular grain or pillar? Let's say I want to know all my Ubuntu 18.x hosts. Today I run:
$ sudo salt -G oscodename:bionic test.ping | awk -F: '/:/{print $1}' | sort
I guess there's two questions (emphasis on the second q):
Hopefully this is a really basic question. Any pointers to the documentation that covers this would be appreciated. My google-fu failed me on this one.
On the master:
salt -G oscodename:bionic --preview-target
The output is the list of minions matching that grain:
- minion1
- minion2
Any parameter works which works for minion targeting, that includes pillars with -I
or even both grains and pillars at the same time with -C
.