On Mon, 20 Jun 2011 14:17:46 -0700, Craig White wrote:
> 
> my base/default includes this ntp manifest
> 
> # cat modules/ntp/manifests/ntp.pp
> # ntp.pp
> 
> class ntp {
>   case $operatingsystem {
>     centos, redhat: { 
>       $service_name = 'ntpd'
>       $conf_file = 'ntp.conf.el'
>     }
>     debian, ubuntu: { 
>       $service_name = 'ntp'
>       $conf_file = 'ntp.conf.debian'
>     }
>   }
> 
>   package { 'ntp':
>     ensure => installed,
>   }
> 
>   service { 'ntp':
>     name => $service_name,
>     ensure => running,
>     enable => true,
>     subscribe => File['ntp.conf'],
>   }
> 
>   file { 'ntp.conf':
>     path => '/etc/ntp.conf',
>     ensure => file,
>     require => Package['ntp'],
>     source => "puppet:///ntp/files/${conf_file}",
>   }
> }
> 
> # class {'ntp': }
> 
> So my questions...
> 
> 1. I tested this by moving /etc/ntp.conf on my test client but it doesn't 
> seem to replace the file though it clearly says 'ensure => file'
>     Is my understanding wrong?
> 

That should replace the file.  What output are you getting (if
anything)?

  % cat ../test.pp
  file { 'blab':
    path    => '/tmp/blab.txt',
    ensure  => 'file',
    content => 'asdf',
  }

  % puppet apply ../test.pp
  notice: /Stage[main]//File[blab]/ensure: defined content as 
'{md5}912ec803b2ce49e4a541068d495ab570'
  notice: Finished catalog run in 0.06 seconds

  % rm /tmp/blab.txt

  % puppet apply ../test.pp
  notice: /Stage[main]//File[blab]/ensure: defined content as 
'{md5}912ec803b2ce49e4a541068d495ab570'
  notice: Finished catalog run in 0.06 seconds

  % puppet apply ../test.pp
  notice: Finished catalog run in 0.04 seconds

> 2. Files ntp.conf.el & ntp.conf.debian are located in 
> /etc/puppet/modules/ntp/files   - source => 
> 'puppet://puppet:///ntp/files/${conf_file} is this correct?
> 

You should include 'modules' in the 'puppet://' URI, since the form
without it has been deprecated for a while.  IIRC it should look
something like:

  puppet:///modules/ntp/files/${conf_file}

-- 
Jacob Helwig

Attachment: signature.asc
Description: Digital signature

Reply via email to