本文介绍了如何设置默认的hiera查找值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Hiera设置我的人偶代码,这样,如果在Hiera中找不到值,它将为其分配默认值.我没有得到理想的结果,并且想知道其他人是如何做到的:

I am setting up my Puppet code using Hiera such that if a value is not found in Hiera, it assigns a default value to it. I am not getting the desired results and wanted to know how others did it :

lookup( <NAME>, [<VALUE TYPE>], [<MERGE BEHAVIOR>], [<DEFAULT VALUE>] )

我想我找到了答案 https://www.devco. net/archives/2016/03/13/the-puppet-4-lookup-function.php ,很快就会尝试

I think I found the answer https://www.devco.net/archives/2016/03/13/the-puppet-4-lookup-function.php, will try it shortly

lookup({"name" => "some::thing", "default_value" => "default"})

推荐答案

最适合我的解决方案是:

The solution that worked for me was :

$myvar1 = lookup( { "name" => "myvar1", "default_value" => "default" } )

这篇关于如何设置默认的hiera查找值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-22 18:52