So I have a bunch of linux servers in different groups. Each server's group
is defined as a custom fact. I want to set an array variable based on the
server's group membership, so I have code like this:
case $servergroup {
MAMMAL: { $foo = ['horse', 'cow', 'dog'] }
REPTILE: { $foo = ['gator', 'frog'] }
BIRD: { $foo = ['finch', 'chicken'] }
}
This works fine. The problem is that now I have a server that needs to be
in two groups. I know I can convert a custom fact into an array like this:
$slist = split($servergroup, ',')
But I don't know how to have each value in the array be processed through
the case statement. I tried this (using the future parser):
each($slist) |$val| { case $val {
MAMMAL: { $foo = ['horse', 'cow', 'dog'] }
REPTILE: { $foo = ['gator', 'frog'] }
BIRD: { $foo = ['finch', 'chicken'] }
}
}
But I just get an error.
(There's another issue, which is that I'll want the $foo array to append to
the previous value rather than overwrite, but I'll deal with that after
getting over this hurdle).
Is what I'm trying possible? Am I going about this totally the wrong way?
--
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/puppet-users/389e93a2-1655-43dc-bde8-79a595f83684%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.