Puppet node definition

puppet

That's a simple question that is stolen my time, and getting me crazy. Very simple I can't understand why this regexp is not getting running when I define a new node in puppet:

Hostname: api01.eu-west-1.compute.internal

Node definition

3: node ^api\d+\.eu-west-1\.compute\.internal {
4:        include sudo
5:        package { 'vim': ensure => preset } 
6: }

My error:

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

Thanks

Best Answer

If you're going to match nodes using regular expressions you need to put the pattern inside /.../, like this:

node /^api\d+\.eu-west-1\.compute\.internal/ {
       include sudo
       package { 'vim': ensure => present } 
}

You can read more here

Related Topic