On Jun 20, 2011, at 2:35 PM, Jacob Helwig wrote:

> 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}
-----
I sort of think it should just work but it doesn't

# mv /etc/ntp.conf /root/
root@ubuntu:/var/www/puppet-dashboard# puppet agent --test --verbose --server 
ubuntu.ttinet
info: Retrieving plugin
info: Caching catalog for ubuntu.ttinet
info: Applying configuration version '1308606646'
notice: Finished catalog run in 0.14 seconds

still no /etc/ntp.conf

root@ubuntu:/var/www/puppet-dashboard# puppet apply 
/etc/puppet/modules/ntp/manifests/ntp.pp
notice: Finished catalog run in 0.01 seconds

above is what I got from the 'puppet apply' command and before from puppet 
agent command, neither replaced /etc/ntp.conf and neither indicated an error.

root@ubuntu:/var/www/puppet-dashboard# ls -l /etc/ntp.conf
ls: cannot access /etc/ntp.conf: No such file or directory

and this was after I changed the source as you indicated...

# tail -n 5 /etc/puppet/modules/ntp/manifests/ntp.pp
   source => "puppet:///modules/ntp/files/${conf_file}",
 }
}

# class {'ntp': }

Craig

-- 
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