简体   繁体   中英

puppet use hiera with module

I am going to use puppet bind module from

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

any idea how I can use hiera in yaml format with this?

I have tried using this in Hiera, but it does not pass the values to the module.

---
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 .

Creating values for define instances in Hiera is a two-step process.

  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.

like

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

The default result of {} will (correctly) lead to no resources being created.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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