使用 Hiera 进行参数映射
Parameter mapping with Hiera
是否可以将 hiera 参数映射到另一个参数?
例如,如果在 hiera 中已经有一个参数 "person::shoe::size" ,并且 puppet 模块 "other_module" 需要像这样查找参数: hiera(person_shoe_size).
是否可以告诉 hiera 参数 "person_shoe_size" 与 "person::shoe::size" 相同,而 hiera(person_shoe_size) 实际上应该映射到 hiera(person::shoe ::尺寸)?
是的,您可以在您的值内进行 hiera 查找。
person::shoe::size: "7"
person_shoe_size: "%{hiera('person::shoe::size')}"
查找任何一个都会 return 7
。您也可以这样做:
hostname: "cool-hostname"
module::fully_qualified_name: "%{hiera('hostname')}.domain.tld"
此处,fully_qualified_name
参数的值为 cool-hostname.domain-tld
。
是否可以将 hiera 参数映射到另一个参数?
例如,如果在 hiera 中已经有一个参数 "person::shoe::size" ,并且 puppet 模块 "other_module" 需要像这样查找参数: hiera(person_shoe_size).
是否可以告诉 hiera 参数 "person_shoe_size" 与 "person::shoe::size" 相同,而 hiera(person_shoe_size) 实际上应该映射到 hiera(person::shoe ::尺寸)?
是的,您可以在您的值内进行 hiera 查找。
person::shoe::size: "7"
person_shoe_size: "%{hiera('person::shoe::size')}"
查找任何一个都会 return 7
。您也可以这样做:
hostname: "cool-hostname"
module::fully_qualified_name: "%{hiera('hostname')}.domain.tld"
此处,fully_qualified_name
参数的值为 cool-hostname.domain-tld
。