On Mon, Jun 15, 2009 at 09:27:02AM +1000, Geoff Crompton wrote:
> Currently, if I want to remove resources from a node that I've
> previously configured, I'm doing 'anti' patterns. Is there away for
> puppet to do it for me? For example, if I started with:
>
This sort of functionality is something I've been thinking about for a
while. If it is something we could work out I think it is something
that would take puppet to another level.
Maybe the implementation would be something like this.
For native types you would define something like
file {
'/etc/apache/sites-enabled/moo':
source => 'puppet:///config/moo',
reverse => true,
}
for custom defines or more complex types where you need to do more
than the obvious.
file {
'/etc/apache/sites-enabled/moo':
source => 'puppet:///config/moo',
reverse => Exec["$name:anti"}
}
exec {
'/etc/apache/sites-enabled/moo:anti':
command => "mv /etc/apache/sites-enabled/moo /backups/moo",
notify => Service['apache']
}
Puppet would then do some sort of diff between the configurations to
work out what has disappeared since the last run.
This is obviously a lot more complex and probably has some really ugly
corner cases.
Apache sites-available/enabled files are the biggest use case for
myself. It would be great to know that if I just remove the
declaration from my nodes.pp then the file automatically disappears on
the server without me having to worry about it.
On second thoughts probably scratch the first example above as you
would then probably also have potentially need to add reverse_notify
etc which might be overkill.
Cheers,
John
--
John
Blog http://www.inodes.org/blog
OLPC Friends http://olpcfriends.org
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---