Thanks all for the suggestions so far. A little more info to make it
clear what I'm trying to do.
Basically, I don't want to stop Puppet from running and managing the
rest of the system, I just don't want it changing the state of the
service itself. For example, an Apache http server is in maintenance
mode because someone is troubleshooting an issue or something like that.
I want to be able to have apache running, or not, but I don't want
apache to be started or stopped while I'm working on it. For example,
debugging some dynamic pages or something like that. I know I can turn
off puppet, and in some cases that is the better way to go. But for some
things, like say a dev or qa server, where I have other things running
that need to be kept up to date, I want the option of controlling the
service itself. Once out of maintenance, I want Puppet to resume
controlling the running state.
I'll report back what I'm able to get to work.
Marc
On 8/11/10 1:44 PM, Nan Liu wrote:
On Wed, Aug 11, 2010 at 12:27 PM, Marc Zampetti
<[email protected] <mailto:[email protected]>> wrote:
To do this, I see two issues.
1) How do I test for the existence of a file? The docs don't seem
to be able to do so. I'm guessing I would need to define a custom
fact for that, right?
2) How do make it so that the service "ensure" property is
correct? Right now, it appears that only "running" or "notrunning"
is valid. Would "ignored" or undef or something like that work?
Depends whether you want puppet to fail the rest of the dependency of
this service or simply not perform any changes to the service state
but allow the rest of the manifest to process without any issues.
In the first scenario, require an exec which checks for file absent.
In the second scenario, write a custom fact $maintenance (recommend
prefixing your site name to the fact) and simply apply the
meta-parameter noop => true and Puppet simply won't make any changes
to the service state:
# maintenance.rb
Facter.add("maintenance") do
setcode do
File::exists?("/path/to/file")
end
end
# in Puppet Class
If ${maintenance} {
notice ("System in maintenance mode.")
Service {
noop => true,
}
}
Not sure if it's ideal, since both solutions will generate a fair
amount of logging.
Thanks,
Nan
--
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.
--
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.