On Mon, Sep 19, 2011 at 03:32:17PM -0700, Troy Stribling
wrote:> In the puppet log file I see refresh events for Service and Mount
> resources. During the refresh event the Service is stopped and started
> and the Mount is mounted and unmounted. What is the purpose of this?
>
Different resource types implement different actions upon refresh. Like
you already discovered:
* exec resource executes the command again
* service resource restarts the service
* mount resource remounts
This is important if you have relationships between resources e.g. you
manage a service and its configuration file. If you change the
configuration file you most likely want the service to restart
afterwards:
file { ''/etc/rsyslog.conf'':
ensure => file,
content => ...
}
service { ''rsyslog'':
ensure => running,
subscribe => File[''/etc/rsyslog.conf''],
}
Whenever the resource File[''/etc/rsyslog.conf''] changes the
service gets
restarted. Or consider the following
file { ''/etc/mail/sendmail.mc'':
ensure => file,
content => ''...'',
}
exec { ''/etc/mail/make'':
refreshonly => true, # Do not execute on every run
subscribe => File[''/etc/mail/sendmail.mc''],
}
If we change sendmail.mc we want to create a new sendmail.cf. We dont
want to run the make command every time puppet runs (refreshonly =>
true) but only if refresh is called because the sendmail.mc changed.
The mount type is special because it notifies itself whenever it detects
a change. So if fstype/device/option is out of sync and puppet modifies
the (v)fstab, refresh is called and puppet performs a remount.
-Stefan
--
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+unsubscribe@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/puppet-users?hl=en.