这是一个浪费我时间并让我抓狂的简单问题。非常简单,我无法理解为什么当我在 Puppet 中定义新节点时,此正则表达式无法运行:
主机名:api01.eu-west-1.compute.internal
节点定义
3: node ^api\d+\.eu-west-1\.compute\.internal {
4: include sudo
5: package { 'vim': ensure => preset }
6: }
我的错误:
err: Could not retrieve catalog from remote server: Error 400 on SERVER:
Could not parse for environment production: Could not match
^api\d+\.eu-west-1\.compute\.internal at /etc/puppet/manifests/nodes.pp:3
on node api01.eu-west-1.compute.internal
谢谢
答案1
如果您要使用正则表达式匹配节点,则需要将模式放在里面/.../
,如下所示:
node /^api\d+\.eu-west-1\.compute\.internal/ {
include sudo
package { 'vim': ensure => present }
}
您可以阅读更多这里