On Dec 19, 2010, at 8:03 PM, Nicolas Aizier wrote:
> Hi everyone,
>
> I'm actually working on implementing templates as it is a very
> convenient and powerfull way to configure files properly. But I'm
> actually meeting a little problem, not a blocking one but a strange
> thing.
>
> Basically my module is configuring the ntp client, no big deal.
> manifest/init.pp of the module define a simple variable from facts to
> know if it's a VM or not
>
> code :
> ***************************************
>
> $HardwareType = $manufacturer ? { 'VMware, Inc.' => 'VM', default =>
> 'PHYSICAL' }
> $ntpserver = 'time.au.fcl.internal'
>
> class ntp
> {
> package { 'ntp':
> ensure => present,
> }
>
> file { '/etc/ntp.conf':
> owner => root,
> group => root,
> mode => 644,
> content => template('/etc/puppet/modules/ntp/templates/
> ntp.conf.erb'),
> notify => Service['ntpd'],
> require => Package['ntp'],
> }
>
> service { 'ntpd':
> ensure => running,
> enable => true,
> hasrestart => true,
> require => Package['ntp'],
> }
> }
> ***************************************
>
> and template from the same module check if it's a VM or not and add a
> special parameter to the ntp.conf if it is.
>
> extract from the code :
> ***************************************
> <% if @HardwareType == "VM" %>
> # VMWare Option:
> # Instructs NTP not to give up if it sees a large jump in time.
> # This is important for coping with large time drifts and resuming
> virtual machines from their suspended state.
> tinker panic 0
> <% end %>
> ***************************************
>
> My problem is that on the first run I got a nice error like :
> ***************************************
> [r...@foo puppet]# puppet agent --test
> notice: Ignoring --listen on onetime run
> err: Could not retrieve catalog from remote server: Error 400 on
> SERVER: Failed to parse template /etc/puppet/modules/ntp/templates/
> ntp.conf.erb: Could not find value for 'ntpserver' at /etc/puppet/
> modules/ntp/manifests/init.pp:25 on node foo.fqdn
> warning: Not using cache on failed catalog
> err: Could not retrieve catalog; skipping run
> ***************************************
>
> Second run is fine even if run directly after the first one .... ????
> /etc/puppet/modules/ntp/manifests/init.pp:25 is the "content template"
> line. So it seems that puppet didn't manage to get the variable on the
> first run but the second run is ok. Strange isn't it ? Any hint ?
Does the template use the $ntpserver line? Right now something's not making
sense and I'd guess it's because something is left out.
--
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/puppet-users?hl=en.