Re: [Puppet Users] hiera, template and array

2023-03-30 Thread Laci D
*puppetlabs-ntp* doesn't support FreeBSD. I do use this module to manage ntp on Ubuntu. On Wednesday, March 29, 2023 at 4:44:21 PM UTC-4 LinuxDan wrote: > Silly question: Why not use > https://forge.puppet.com/modules/puppetlabs/ntp ? > ___

Re: [Puppet Users] hiera, template and array

2023-03-29 Thread 'Dan White' via Puppet Users
Silly question: Why not use https://forge.puppet.com/modules/puppetlabs/ntp ? ___ Dan White : d_e_wh...@icloud.com “Sometimes I think the surest sign that intelligent life exists elsewhere in the universe is that none of it has tried to

Re: [Puppet Users] hiera, template and array

2023-03-29 Thread Laci D
The following configuration is finally working, yay! I replaced "servers" with "*ntp_host*" in hiera to have a clean separation between "server" and "servers". Thank you for the help! templates/ntp/ntp.conf.erb # File is managed by Puppet <% if @ntp['ntp_host'] -%> server <%=

Re: [Puppet Users] hiera, template and array

2023-03-29 Thread Martin Alfke
In EPP the template must look different: <% $site::profiles::ntp::ntp[‘servers'].each |$server| { -%> server: <%= $server %> <% } -%> An array may consist of a single entry only. > On 28. Mar 2023, at 16:30, Laci D wrote: > > I tried both epp and erb templates. > > This is the manifest file:

Re: [Puppet Users] hiera, template and array

2023-03-28 Thread Laci D
I tried both epp and erb templates. This is the manifest file: class site::profiles::ntp { $ntp = hiera_hash('ntp') case $::operatingsystem { 'freebsd': { file { "/etc/ntp.conf": ensure => file, recurse => true,

Re: [Puppet Users] hiera, template and array

2023-03-28 Thread Martin Alfke
My example is an epp template. What name does the variable have? $ntp? And: is this a hash with servers key set to an array? In this case your erb (!) template can look like the following: <% @ntp[’servers’].each { |server| -%> server: <%= server %> <% } -%> > On 28. Mar 2023, at 14:37, Laci

Re: [Puppet Users] hiera, template and array

2023-03-28 Thread 'Dirk Heinrichs' via Puppet Users
Am Dienstag, dem 28.03.2023 um 05:37 -0700 schrieb Laci D: Since "servers" is under "ntp" in the hiera file (see example in my original email) maybe we need to define that in the erb file? I think the example is slightly wrong. Should IMHO be "@servers" and then just "server" (without the

Re: [Puppet Users] hiera, template and array

2023-03-28 Thread Laci D
Thank you Martin! I used your example and I think something is missing. Since "servers" is under "ntp" in the hiera file (see example in my original email) maybe we need to define that in the erb file? Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Internal Server

Re: [Puppet Users] hiera, template and array

2023-03-28 Thread Martin Alfke
You must iterate as servers is an array: <% $servers.each |$server| { -%> server: <%= $server %> <%- } -%> > On 27. Mar 2023, at 22:21, Laci D wrote: > > I'm working on defining NTP servers from Hiera. > > For Linux servers I have been using puppetlabs-ntp, which has been working > nicely.