Skip to content

Instantly share code, notes, and snippets.

@ody
Created July 2, 2015 19:05
Show Gist options
  • Select an option

  • Save ody/92beac097b39e9455209 to your computer and use it in GitHub Desktop.

Select an option

Save ody/92beac097b39e9455209 to your computer and use it in GitHub Desktop.
$dns_hosts = [{
'title' => 'test-1a-record.testme.puppetlabs.net',
'parameters' => {
"domain"=>"testme.puppetlabs.net",
"ddns_key"=>"/etc/bind/keys.d/dhcp_updater",
"customername"=>"puppetlabs",
"ttl"=>"4800", "provider"=>"bind",
"username"=>"puppetlabs",
"content"=>"172.16.100.150",
"type"=>"A",
"ensure"=>"present",
},
},]
each($dns_hosts) |$record| {
$record_title = $record['title']
$record_params = $record['parameters']
$hash_variables = { "$record_title" => $record_params }
$hash_hash = { "${record['title']}" => $record['parameters'] }
notify { "A hash built from variables ${hash_variables}": }
notify { "A hash built from a hash ${hash_hash}": }
# notify { "${hash_variables}": }
# notify { "${hash_hash}": }
#notify { $record_title: message => $record['parameters'] }
#notify { $record['title']: message => $record['parameters'] }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment