網路論壇
登入
網路論壇
Puppet Users
會話群組
關於
提供意見
說明
Nested interpolation
瀏覽次數:7 次
跳到第一則未讀訊息
Helmut Schneider
未讀,
2020年3月13日 清晨5:45:21
2020/3/13
回覆作者
登入以回覆作者
轉寄
登入以轉寄訊息
刪除
你的權限不足,無法在這個群組刪除訊息
複製連結
檢舉訊息
顯示原始貼文
該群組的電子郵件地址為匿名,或你需要檢視成員電子郵件地址的權限才能查看原始貼文
收件者: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
未讀,
2020年3月13日 下午1:10:31
2020/3/13
回覆作者
登入以回覆作者
轉寄
登入以轉寄訊息
刪除
你的權限不足,無法在這個群組刪除訊息
複製連結
檢舉訊息
顯示原始貼文
該群組的電子郵件地址為匿名,或你需要檢視成員電子郵件地址的權限才能查看原始貼文
收件者: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/
回覆所有人
回覆作者
轉寄
0 則新訊息