如何使hiera输出文字字符串'%{:: fqdn}'? [英] How to get hiera to output the literal string '%{::fqdn}'?

查看:83
本文介绍了如何使hiera输出文字字符串'%{:: fqdn}'?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道我的yaml文件中需要什么才能使hiera输出文本字符串%{::fqdn},而不是输出the事实fqdn的值.

I would like to know what I would need to have in my yaml file to have hiera output the literal string %{::fqdn} instead of outputting the value of the puppet fact fqdn.

这是我尝试过的.

# grep foo::p4 /etc/puppetlabs/code/environments/production/hieradata/bar.yaml
foo::p4: 'http://%{hiera(''p1'')}/%{::fqdn}'

这是结果:

# hiera foo::p4 '::prefix_fact=bar' '::fqdn=thing.com' environment=production
http://test/thing.com

我真正想要的输出是:

http://%{hiera('p1')}/%{::fqdn}

我想我可以像这样愚蠢地做些事情:

I guess I could do something goofy like this:

p1: 'test'
pa: '%{hiera'
pb: '("p1")}'
pc: '%{::fq'
pd: 'dn}'
foo::p4: "%{hiera('pa')}%{hiera('pb')}%{hiera('pc')}%{hiera('pd')}"

然后输出就是我想要的:

Then the output is what I want:

# hiera foo::p4 '::prefix=bar' '::fqdn=thing.com' environment=production
%{hiera("p1")}%{::fqdn}

推荐答案

根据 查看全文

登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆