I have a resource I'd like to manage via augeas (/etc/conf.d/net; it's a bash variables file) but I"m having problems figuring out how to set the values so that all of the values in the array go in.
I would like it to look like this:
# cat /etc/conf.d/net
config_eth4=("192.168.128.2/24")
config_eth5=("192.168.129.2/24")
routes_eth5=("192.168.130.0/24 via 192.168.131.1")
But it ends up looking like this:
config_eth4=192.168.128.2/24
config_eth5=192.168.129.2/24
routes_eth5=192.168.130.0/24
The goal is to be able to assign multiple values to "ip" or "routes" for an
interface.
Is this something I might have to do w/ a custom type?
-Doug
class net {
file { "/etc/conf.d/net":
owner => root, group => root, mode => 0644,
}
# TODO remove undefined routes
define interface($ip, $routes = undef) {
exec { "net_restart_$name":
#TODO: perform restart
command => "/bin/true",
refreshonly => true,
}
augeas { "conf.d_net_ip_$name":
notify => Exec["net_restart_$name"],
context => "/files/etc/conf.d/net",
changes => "set config_$name $ip",
}
if $routes {
augeas { "conf.d_net_routes_$name":
notify => Exec["net_restart_$name"],
context => "/files/etc/conf.d/net",
changes => "set routes_$name $routes",
}
}
else {
augeas { "conf.d_net_routes_$name":
notify => Exec["net_restart_$name"],
context => "/files/etc/conf.d/net",
changes => "rm routes_$name",
onlyif => "match routes_$name size > 0",
}
}
}
}
node 'example' {
include net
net::interface { "eth4": ip => ["192.168.128.2/24"], }
net::interface { "eth5": ip => ["192.168.129.2/24"],
routes => ["192.168.130.0/24 via 192.168.131.1"],}
}
signature.asc
Description: OpenPGP digital signature
