On 12/20/2010 05:03 AM, 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' }
Hi,
this slipped me too at first, but do take note of the $virtual fact.
(E.g. "facter virtual")
> $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'],
> }
> }
> ***************************************
> 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
As Patrick noted, the $ntpserver variable is biting you here, which is
indeed strange. You may want to try and include its declaration in the
ntpserver class proper.
Also, it appears valid to include a default value in your template, see
http://projects.puppetlabs.com/projects/puppet/wiki/Puppet_Templating on
the topic of undefined variables.
HTH,
Felix
--
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.