how do i get $title from the hiera array

25 views
Skip to first unread message

Helen Paterson

unread,
Nov 24, 2016, 8:58:05 AM11/24/16
to Puppet Users


I would like to get the hiera array title only, i.e  i'd like to lookup  Admin, Public,Assets without the ip_address returning aswell?

iis::sites:
 'Admin':
    ip_address: '10.21.40.18'
    #host_header: 'www.internalapi.co.uk'
 'Public':
    ip_address: '10.21.41.18'
 'Assets':
    ip_address: '10.21.42.18'


I'm currently trying 

$sites = hiera_hash('coldfusion_v11::sites')
$site = $sites [$name]


This works to pull back only the ip address, but i need the title

$sites = hiera_hash('coldfusion_v11::sites')
$site = $sites [$ip_address]

Rob Nelson

unread,
Nov 24, 2016, 9:11:34 AM11/24/16
to puppet...@googlegroups.com
If you're using puppet 4, try '$sites.each |$site, $options| { # $site will be the hash key in this block }' - written from a phone so please validate syntax before using :)

--
You received this message because you are subscribed to the Google Groups "Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/defdde4a-dc38-4d46-9f93-fea29ee6692a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
Rob Nelson
Reply all
Reply to author
Forward
0 new messages