Skip to content

Instantly share code, notes, and snippets.

@SimonHoenscheid
Created March 11, 2016 15:45
Show Gist options
  • Save SimonHoenscheid/465bd8ceb6836cbbe4ba to your computer and use it in GitHub Desktop.
Save SimonHoenscheid/465bd8ceb6836cbbe4ba to your computer and use it in GitHub Desktop.
nginx::vhost::vhosts:
'foo.example.com':
ensure: 'present'
'example.net':
ensure: 'present'
$vhosts = hiera('nginx::vhost::vhosts')
$vhosts_list = keys($vhosts)
each($vhosts_list) |String $vhost_name| {
$vhost_config_ensure = $vhost_name['ensure']
notify{"Vhost ${vhost_name} is set to ${vhost_config_ensure}":}
}
Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Evaluation Error: The value 'ensure' cannot be converted to Numeric. at /etc/puppetlabs/code/environments/production/modules/nginx/manifests/vhost.pp:25:40 on node puppetclient-01.local
@tuxmea
Copy link

tuxmea commented Mar 11, 2016

$vhost=hiera('nginx::vhost::vhosts')

$vhost.each |$key, $value| {
notify { "VHost: ${key} - Value: ${value['ensure']}": }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment