Possible to get just the keys out of a hiera hash?

32 views
Skip to first unread message

Kenton Brede

unread,
Mar 5, 2014, 3:56:26 PM3/5/14
to puppet...@googlegroups.com
So in hiera I've got:

users_common:
    user1:
        ensure: present
        home: /home/user1
        managehome: true
    user2:
        ensure: present
        home: /home/user2
        managehome: true

I'm using "users_common" with a create_resources in one class but I'd like to just pull out "user1, user2" into an array from "users_common" for a different class.

Is this possible? 

Something like:

$users_c = hiera('users_common')
$users = "${users_c['keys']}"
notify { "${users}": }

Thanks,

--
Kent



Robin Bowes

unread,
Mar 5, 2014, 4:03:20 PM3/5/14
to puppet...@googlegroups.com
Have a look in stdlib for the keys function.

R.


--
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/CA%2BnSE3-yW2XYU5V7-hwKkuydGpAnHcW7bJW6XUwmMhpon%2BjDiA%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.

Kenton Brede

unread,
Mar 5, 2014, 5:01:17 PM3/5/14
to puppet...@googlegroups.com
Works great! -- Thanks.



For more options, visit https://groups.google.com/groups/opt_out.



--
Kent Brede




Reply all
Reply to author
Forward
0 new messages