I'm struggling to get this to work and don't understand where I'm going wrong, can someone please guide me on how to correct?
Basically I want to get an array in my nodes.pp, which is then used by my templates file by cycling through it and writing a line of each element:
nodes.pp:
node test{
net::addr { 'routing':
$routes = {
route1 => {
address => '172.29.54.70',
netmask => '255.255.255.0',
gateway => '172.29.54.65',
dev => 'eth0',
},
route2 => {
address => '192.168.1.3',
netmask => '255.255.255.0',
gateway => '192.168.1.1',
dev => 'eth3',
},
}
}
}
When I run the puppet client i keep getting the following:
err: Could not retrieve catalog from remote server: Error 400 on SERVER: Could not parse for environment production: Syntax error at '='; expected '}' at /etc/puppet/manifests/nodes/ test.pp:3 on node test.myincorp.net
addr.pp
define net::addr (
$address='',
$netmask='',
$gateway='',
$dev='',
) {
file { "route-${name}":
ensure => 'present',
mode => '0644',
owner => 'root',
group => 'root',
path => "/etc/sysconfig/network-scripts/route-${name}",
content => template('network/addr.erb'),
}
}
Template: addr.erb:
<% routes.each do |route| -%>
<%= route['address'] %> <%= route['netmask'] %> <%= route['gateway'] %> <%= route['dev'] %>
<% end -%>
<% end -%>
<% end -%>
Can someone help me with fixing the above please?
Thanks Dan