Ask Your Question

is it possible to have a script/trigger/plugin run on instance creation/deletion?

asked 2015-02-04 18:14:13 -0500

sjoeboo gravatar image

i have a need to have a simple script/trigger/plugin, whatever you want to call it, run when an instance is created and/or when an instance is deleted. I would simply need the instance name(or, IP), as input. I've been searching around and haven't found any examples of such functionality, is there a mechanism for something like this in Nova/openstack?

For further explanation, this is for dealing with Puppet certificates, as well as resources/facts. I need to not only mark resources which existed on instances which no longer exist as expired, but also need to automatically clean up instances certificates when they come down, so another instance on the same ip (and thus, in our environment, same hostname), can successfully provision itself.

I've done this with many other...."traditional" provisioning systems (cobbler, etc) and am struggling to find a way to hook this into Nova/Openstack. I would prefer to have the controller system(s) fire this, not the instances themselves, for security purposes. My site can be thought of as a single tenant site, so we want this to happen for ALL instances (it fails gracefully anyways), regardless of image/tenant/project/flavor/etc.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2015-02-04 22:53:58 -0500

larsks gravatar image

There is probably more than one way to solve this problem, but a simple solution might involve Nova's support for Hooks. There are specific hooks that run on instance creation and instance deletion.

Once upon a time I wrote a blog post about this feature.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower


Asked: 2015-02-04 18:14:13 -0500

Seen: 484 times

Last updated: Feb 04 '15