On Sun, Aug 14, 2011 at 10:18 AM, Alex L. Demidov
<alexeydemi...@gmail.com> wrote:
> I'm trying to implement /etc/hosts handling using hiera as data
> source, but my current implementation requires data duplication
> because I could pass only array of strings as $name to host resource.
> Is there any way to avoid such data duplication? Or maybe it is
> possible to use templates but keep ability to have local modifications
> to /etc/hosts file?
>
> class hosts ($hosts = hiera("hosts"), $hostsdefs =
> hiera("hostsdefs"))  {
>
>      define hostentry( ) {
>          host{ $name: ip => $hostsdefs[$name][ipaddress],
> host_aliases => $hostsdefs[$name][host_aliases]  }
>      }
>
>      hostentry{ $hosts: }
> }
>
> common.yaml
> ----
> hosts:
>    - host1.example.com
>    - host2.example.com
> hostsdefs:
>    host1.example.com:
>          ipaddress: 10.0.0.1
>          host_aliases: host1
>    host2.example.com:
>          ipaddress: 10.0.0.2
>          host_aliases: host2
>

Write a puppet function that returns hash key as an array and you can
avoid this data duplication.

Thanks,

Nan

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to