Puppet

Puppet 代理不從正則表達式執行清單

  • September 17, 2018
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 個節點中的任何一個節點下,它會在我 write 之後執行sudo puppet agent --test,但如果它在 regexp 下則不會。

如果我想讓某些節點做某些事情,我該怎麼做,但是有一些命令我想讓它們都做?在每個節點下寫include sup似乎非常煩人。

Puppet 匹配一個節點,一旦匹配,它就會停止。FQDN 是最高的,它會降低到預設值。請參閱匹配部分 - https://puppet.com/docs/puppet/4.10/lang_node_definitions.html

一種方法是只使用您的正則表達式節點,然後對每個節點獨有的事物使用 case 語句

節點 /node-slave\d+/ { 包括燈 包括測試 包括 fun::rup 包括 sup

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

引用自:https://unix.stackexchange.com/questions/469510