Bret Wortman
2014-Jan-27 19:50 UTC
[Puppet Users] How to execute a target action before this one when this one triggers
I'm looking at the case of distributing /etc/cups/printers.conf.
When this file changes, I'd like to distribute it. But before placing the
new file, cupsd needs to be shut down, and restarted again afterwards. This
can be done easily enough using an Exec to shut it down and the existing
Service entry to trigger a restart, but how can I tell my manifest that
when the File triggers, first do the Exec, then the File, then the Service?
Is there a way to chain these together to produce the effect I'm looking
for? To stop a service before deploying a new config file, then start it up
again?
file { '/etc/cups/printers.conf':
require => Package['cups'],
source => 'puppet:///modules/cups/printers.conf',
notify => Service['cupsd'],
:
}
service { 'cupsd':
ensure => running,
enable => true,
}
exec { 'stop-cupsd':
command => 'service cupsd stop',
:
}
--
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to puppet-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/puppet-users/2878a401-5bd8-4ac5-996f-79c4dc289724%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.