Groups
Groups
Sign in
Groups
Groups
Puppet Users
Conversations
About
Send feedback
Help
Nested interpolation
9 views
Skip to first unread message
Helmut Schneider
unread,
Mar 13, 2020, 5:45:21 AM
3/13/20
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to puppet...@googlegroups.com
Hi,
I'm using something like this:
netconfig:
hostname: 'BSDHelmut'
interfaces:
"%{facts.networking.primary}":
ip4: &ip4 '192.168.124.35'
cidr4: &cidr4 '
192.168.124.35/24
'
ip4aliases:
- '
192.168.124.36/32
'
ip6: &ip6 'DHCP'
Can I either do something like
- "%{lookup('netconfig.interfaces.%{facts.networking.primary}.ip4.helmut')}"
- "text*{ip4}text"
Thank you!
Henrik Lindberg
unread,
Mar 13, 2020, 1:10:31 PM
3/13/20
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to puppet...@googlegroups.com
No, you cannot do nested interpolations in hiera directly like that.
You would need to write your own hiera backend function to do that kind
of combined lookup. It is easier than it sounds.
An alternative to using your own is to use this function as a backend:
https://github.com/hlindberg/tahu/blob/master/lib/puppet/functions/tahu/ppyaml_key.rb
It allows you to write snippets of Puppet Language logic in your data
files - thus you can do puppet language interpolation and lookup the
result as a key.
- henrik
--
Visit my Blog "Puppet on the Edge"
http://puppet-on-the-edge.blogspot.se/
Reply all
Reply to author
Forward
0 new messages