I have a Puppet script that handles things differently in different environments based on an if/else
block. But I have a bunch of common file resource blocks at the bottom that apply to all environments. Currently, those blocks notify => Service['my-service']
, but for production, I want it to not notify. I only want it to update the files, not start or stop any services.
My initial idea is, can I store the Service into a variable and set it in each section?
Example:
if ($env == 'dev') {
$myService = Service['my-service']
} elsif ($env == 'prod') {
$myService = Service['dummy-service']
}
file { "myfile.xml":
ensure => file,
content =>
template("mytemplate.erb"),
require => Package['my-service'],
notify => $myService
}
I'm not sure if that will work or not, but if it does, what could I use for a dummy service?