0
node 'node-slave01' {
        include repo::git
        include fun::cmatrix
}
node 'node-slave02' {
        include repo::hg
        include fun::toilet
}
node 'node-slave03' {
        include fun::rup
        include repo::svn
        include fun::cmatrix
}
node 'node-slave04' {
        include repo::git
        include repo::hg
        include repo::svn
        include fun::cmatrix
        include fun::toilet
}
node /node-slave\d+/ {
        include lamp
        include test
        include fun::rup
        include sup
}

So everything in /node-slave\d+/ doesn't run. If I take the sup module and put it under any of the 4 nodes, it runs after I write sudo puppet agent --test, but not if it's under the regexp.

How do I do it if I want to have certain nodes do certain things, but there are some commands that I want all of them to do? Writing include sup under every node seems extremely annoying.

1 Answer 1

0

Puppet matches one node and once it does that it stops. FQDN is highest and it works down to default. See matching section - https://puppet.com/docs/puppet/4.10/lang_node_definitions.html.

One way to do it is to have just your regex node and then use a case statement for things that are unique to each node

node /node-slave\d+/ { include lamp include test include fun::rup include sup

case $::hostname { 'node-slave01': { include repo::git include fun::cmatrix } node-slave02': { include repo::hg include fun::toilet } } }

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .