If I want to configure syslog-ng instead of rsyslog, or configure rsyslog instead of sysklogd, the previous syslog daemon has to be stopped (and disabled) before the new one starts. De-configuring the previous one works just fine when the service (init script) exists on the system:
$disable = ['rsyslog', 'syslog']
service { $disable:
enable => false,
ensure => stopped,
}
But when the init script doesn't exist, I get something like this:
Jan 17 15:05:44 dpuppet-01 puppet-agent[4011]: (/Stage[main]/Sysklogd::Disable/Service[syslog]/ensure) change from running to stopped failed: Could not find init script for 'syslog'
How would I say "if it's there, disable it, if not, ignore it" in puppet DSL?
(For completeness, this is with puppet 2.6.2 on various platforms.)
exec { "damn!": … }
Sadly, there isn't any way to express this in the DSL. I suspect
there might be a feature request already, but I can't find one, so can
you file one? This seems like a useful thing to do, without thinking
too deeply about it.
--
Daniel Pittman
⎋ Puppet Labs Developer – http://puppetlabs.com
♲ Made with 100 percent post-consumer electrons
You can't use the init.d script (or hasstatus=true) to check for
service, so you fall back and specify the service command in this
case:
service { 'rsyslog':
ensure => stopped, # this is normally first attribute.
enable => false,
status => 'source /etc/init.d/functions; status rsyslogd', # provide
a way to check status regardless if the init.d script is available.
}
Thanks,
Nan