简体   繁体   English

木偶使用希拉与模块

[英]puppet use hiera with module

I am going to use puppet bind module from 我将使用来自的人偶绑定模块

https://github.com/thias/puppet-bind https://github.com/thias/puppet-bind

any idea how I can use hiera in yaml format with this? 任何想法,我怎么能用yaml格式使用hiera?

I have tried using this in Hiera, but it does not pass the values to the module. 我已经尝试在Hiera中使用它,但是它不会将值传递给模块。

---
classes:
  - 'bind::server'

profile::bind::conf:
    '/etc/named.conf':
        zones:
            'example.com': ['type master', 'file ]

any suggestions? 有什么建议么?

The parameters cannot be bound to the module's classes automatically - zones are created through a define . 参数不能自动绑定到模块的类-通过define创建区域。

Creating values for define instances in Hiera is a two-step process. 在Hiera中为define实例创建值需要两个步骤。

  1. Create the data. 创建数据。 Your's is fine, but the key is misleading. 您的还好,但关键是误导。

eg 例如

bind_server_confs:
  '/etc/named.conf':
    zones:
      'example.com': ['type master', 'file ]
  1. Create resources from the hash using the create_resources function. 使用create_resources函数从哈希创建资源。

like 喜欢

create_resources('bind::server::conf', hiera('bind_server_confs'), {})

The default result of {} will (correctly) lead to no resources being created. {}的默认结果将(正确)导致没有资源被创建。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM