SaltStack targeting minions with *

groupssaltstack

I am using SaltStack on my linux boxes and want to define nodegroups. I know about compound matching and minion lists, etc.

This is what I need, and it works this way, but that's hard to maintain with lots of servers

nodegroups:
  group1: 'srv1,srv2,srv3,srv4,dev1,dev2,stage1,stage2'
  

To keep it simple, I'm trying to define them this way:

nodegroups:
  group1: 'srv*,dev*,stage*'

But I can't find a way to do this right. Any ideas?

-=EDIT=-

I tried Dan Garthwaites solution, but it didn't work. I even tried it on my private dev server, which has Salt version 2014.1.4 installed. This is what I get.

Trying as normal list (full hostnames)

fmohr@salt-master:~$ sudo salt -v -C 'L@dns01,apache' test.ping
Executing job with jid 20140708072832751715
-------------------------------------------

dns01:
    True
apache:
    True

with one wildcard

fmohr@salt-master:~$ sudo salt -v -C 'L@dns*,apache' test.ping
Executing job with jid 20140708072837257646
-------------------------------------------

apache:
    True

with all wildcards

fmohr@salt-master:~$ sudo salt -v -C 'L@dns*' test.ping
No minions matched the target. No command was sent, no jid was assigned.

fmohr@salt-master:~$ sudo salt -v -C 'L@dns*,apach*' test.ping
No minions matched the target. No command was sent, no jid was assigned.

I don't think you can use wildcards in lists, but I have no clue how to get salt to target dns* and apach* (as an example).

Best Answer

you should use or to connect them, like this:

nodegroups:
    group1: 'srv* or dev* or stage*'

salt -C 'srv* or dev* or stage*' test.ping

tested on my machine.