Puppet 代理不从正则表达式运行清单

Puppet 代理不从正则表达式运行清单
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
}

所以里面的一切/node-slave\d+/都不能运行。如果我将sup模块放在 4 个节点中的任何一个下,它会在我写入后运行sudo puppet agent --test,但如果它位于正则表达式下则不会运行。

如果我想让某些节点执行某些操作,但我希望所有节点都执行某些命令,我​​该怎么做?在每个节点下写入include sup似乎非常烦人。

答案1

Puppet 匹配一个节点,一旦匹配就会停止。 FQDN 最高,它会降低到默认值。请参阅匹配部分 -https://puppet.com/docs/puppet/4.10/lang_node_definitions.html

一种方法是仅使用正则表达式节点,然后对每个节点特有的内容使用 case 语句

节点 /node-slave\d+/ { include lamp include test include fun::rup include support

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

相关内容