On Thu, Mar 18, 2010 at 2:57 PM, Christopher Johnston
<[email protected]> wrote:
> Can some help explain the differences and use cases of subscribe and
> require. They seem to have a bit overlap in the sense that they do the same
> thing almost. I understand a require sets up a dependency. So for eg the
> following below would setup a dependency on the package pam to be installed
> in order for the file type to run.
> package { 'pam':
> ensure = > latest,
> }
> file { '/etc/pam.d/system-auth':
> ensure => symlink,
> target => 'system-auth-ac',
> require => Package['pam']
> }
> But what I am confused about is how is subscribe different? Doesn't that
> handle the same relationship of saying that you are "subscribing" (and/or)
> requiring something?
Subscribe and notify are responsible for notifying resources of
changes in another resource. For example:
file { "/etc/apache2/httpd.conf";
...
require => Package["apache"],
notify => Service["apache"],
}
The require statement ensures that the package apache is installed
before the file is managed. When the file httpd.conf is updated the
service apache is notified to restart/reload.
Hope this helps
>
> --
> 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.
>
--
Cheers,
Daniel
--
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.