I have a hash with network information structured as such:
$networkinfo = {
'machine1.domain.local' => { eth0 => { ip => '192.168.1.50',
mask => '255.255.255.0', gw => '192.168.1.254' },
eth1 => { ip => '192.168.2.68', mask =>
'255.255.255.0' } },
'machine2.domain.local' => { eth0 => { ip => '192.168.1.51',
mask => '255.255.255.0', gw => '192.168.1.254' },
eth1 => { ip => '192.168.2.74', mask =>
'255.255.255.0' } }
}
In a function I need to access data in this hash without hard coding
everything.
$ipaddress = $networkinfo["$fqdn"]"[$iface"]['ip']
this fails with syntax errors unless specify everything such as
$ipaddress = $networkinfo['machine1.domain.local']['eth2']['ip']
What is the proper syntax to access data within the hash?
--
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/puppet-users?hl=en.