properly removing dead hosts.

277 views
Skip to first unread message

Udo Waechter

unread,
Nov 21, 2009, 8:43:08 AM11/21/09
to Puppet Users
Hello all.

I know there were many discussions about how to remove hosts from puppet. I know the script that removes all entries from the database.

What I am looking for is a solution that sets all exported resources to "ensure => absent". Assumed that they have a "ansure" parameter.

Anyway, I thought that the resources-type would be something that could help, but I really don't get its use. I thought about something like:

node dead-host {
resources{"*":
ensure => "absent",
}
}

So, when dead-host runs puppet, all its resources will be set "absent".
This does not work and additionally it does not cover the case where dead-host dies before having the chance to run for a last time (with the above snipplet)

To resolve the issue above, one would need the possibility to 'fake' the dead-host from another puppet-host.
I have seen that puppetd has the "--fqdn" option, which seems to fake the hostname.

Could I use this option on "alive-host" to do: "puppetd --fqdn dead-host.domain.com -vt"? Would this result in "alive-host" being treated as "dead-host"? If this would work, I could create a node definition with all "anti"-classes and could deconfigure all hosts that no longer exist.

And the last question:
How do you all handle the case when hosts die. Do you simply remove all storedconfigs and do not care about exported resources that might have been imported by other hosts (ssh-keys, mounts, nagios-checks, ...)? Or do you go to all those hosts and remove the resources by hand?

Thanks,
udo.
--
---[ Institute of Cognitive Science @ University of Osnabrueck
---[ Albrechtstrasse 28, D-49076 Osnabrueck, 969-3362
---[ Documentation: https://doc.ikw.uni-osnabrueck.de



Christian Hofstaedtler

unread,
Nov 22, 2009, 6:42:57 AM11/22/09
to Puppet Users


On Nov 21, 2:43 pm, Udo Waechter <udo.waech...@uni-osnabrueck.de>
wrote:
> Hello all.
>
> I know there were many discussions about how to remove hosts from puppet. I know the script that removes all entries from the database.
>
> What I am looking for is a solution that sets all exported resources to "ensure => absent". Assumed that they have a "ansure" parameter.
>
[...]
>
> And the last question:
> How do you all handle the case when hosts die. Do you simply remove all storedconfigs and do not care about exported resources that might have been imported by other hosts (ssh-keys, mounts, nagios-checks, ...)? Or do you go to all those hosts and remove the resources by hand?

We have these stanzas in the manifest for the nagios server:

48 resources { "nagios_service":
49 purge => true
50 }
51 resources { "nagios_host":
52 purge => true
53 }
54 resources { "nagios_hostgroup":
55 purge => true
56 }

For other resources we're using similar stanzas, and for file-snippet
exported resources we just automatically purge the containing
directory.

This combined with cleaning the host from the storedconfigs DB gets
rid of all the traces left.


Christian

David Schmitt

unread,
Nov 23, 2009, 3:55:08 AM11/23/09
to puppet...@googlegroups.com
Christian Hofstaedtler wrote:
> We have these stanzas in the manifest for the nagios server:
>
> 48 resources { "nagios_service":
> 49 purge => true
> 50 }
> 51 resources { "nagios_host":
> 52 purge => true
> 53 }
> 54 resources { "nagios_hostgroup":
> 55 purge => true
> 56 }


Are you aware that you also could write

resources {
[ "nagios_service", "nagios_host", "nagios_hostgroup" ]:
purge => true
}

?


Regards, DavidS
Reply all
Reply to author
Forward
0 new messages