Issue #1886 has been updated by do.
luke wrote:
> do wrote:
> > micah wrote:
> > > 5. Stored configs. I found a script on the wiki that takes care of this:
> > It would be really great if exported resources will be unexported. I am
> > sure that this will not work for most of the resources, but those that have
> > a "ensure" parameter should be set to their opposite:
> >
> > so:
> >
> > @@file{"/bla/bla": ensure => present, }
> >
> > should become
> >
> > @@file{"/bla/bla": ensure => absent, }
> >
> > I guess this increases the complexity of this ticket, but I think that it
> > definetly should be there.
>
> Yeah, this is a pretty significant change; while I can see why you want this,
> I'd say that most cases that use exported resources should also use resource
> purging.
Yes, we have that in our modules (we have anticlasses for all classes that we
do define).
Unfortunately the day comes when a node dies without having the last chance to
be put into such a class and run puppet for the last time.
We have this with about 4 hosts now, and their exported resources are spread
over 4 or 5 other hosts. Now, I need to delete the stored configs, afterwards I
need to log in to all of those machines and delete the resources by hand. Long
tme since I did such things, thanks to puppet :)
----------------------------------------
Feature #1886: Add node cleanup capability
http://projects.reductivelabs.com/issues/1886
Author: micah
Status: Accepted
Priority: Low
Assigned to: masterzen
Category: newfeature
Target version:
Complexity: Easy
Affected version: 0.24.7
Keywords:
There really isn't a good mechanism to clean up when a node no longer exits.
You can remove it from your node definition, but there is a lot of junk hanging
around that should be cleaned up too. It would be really cool if the ability to
wipe a node was built into puppetmaster so you could just simply do something
like:
<pre>
puppetmaster --clean node
puppetmaster --clean node.domain.name
</pre>
and this would clean up everything that puppet can find on that node. The
things that I can think of that need to get cleaned up are:
1. Signed certificates ($vardir/ssl/ca/signed/node.domain.pem)
2. Cached facts ($vardir/yaml/facts/node.domain.yaml)
3. Cached node stuff ($vardir/yaml/node/node.domain.yaml)
4. Reports ($vardir/reports/node.domain)
5. Stored configs. I found a script on the wiki that takes care of this:
<pre>
#!/usr/bin/env ruby
## Usage: sudo ./kill_node_in_storeconfigs_db.rb <hostname as stored in hosts
table>
require 'puppet/rails'
Puppet[:config] = "/etc/puppet/puppet.conf"
Puppet.parse_config
pm_conf = Puppet.settings.instance_variable_get(:@values)[:puppetmasterd]
adapter = pm_conf[:dbadapter]
args = {:adapter => adapter, :log_level => pm_conf[:rails_loglevel]}
case adapter
when "sqlite3":
args[:dbfile] = pm_conf[:dblocation]
when "mysql", "postgresql":
args[:host] = pm_conf[:dbserver] unless pm_conf[:dbserver].empty?
args[:username] = pm_conf[:dbuser] unless pm_conf[:dbuser].empty?
args[:password] = pm_conf[:dbpassword] unless pm_conf[:dbpassword].empty?
args[:database] = pm_conf[:dbname]
else
raise ArgumentError, "Invalid db adapter %s" % adapter
end
ActiveRecord::Base.establish_connection(args)
if @host = Puppet::Rails::Host.find_by_name(ARGV[0].strip)
print "Killing #{ARGV[0]}..."
$stdout.flush
@host.destroy
puts "done."
else
puts "Can't find host #{ARGV[0]}."
end
</end>
Sure, I can do all this manually, but this is a feature request because its a
little annoying and you forget all the pieces.
----------------------------------------
You have received this notification because you have either subscribed to it,
or are involved in it.
To change your notification preferences, please click here:
http://reductivelabs.com/redmine/my/account
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Puppet Bugs" 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-bugs?hl=en
-~----------~----~----~----~------~----~------~--~---