Ask Your Question
0

Have OpenStack run script on every deploy/provision?

asked 2018-03-23 16:42:40 -0500

danigrith gravatar image

I was wondering if there was a way to always run a set of scripts on every VM deploy/provision, ideally in a way that is not dependent on the human putting it in?

I would like to have every VM registered to CMDB, our IPAM (phpIPAM), and FreeIPA (DNS and SSO). I know that cloud-init can be used to accomplish this, but I would like to enforce that these scripts run regardless and not depend on a user to put those scripts in. Is there a recommended way to this, or has anyone done this before with their stuff that they could recommend and show me?

Thanks!

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2018-03-23 20:29:19 -0500

updated 2018-03-25 09:44:23 -0500

Although you often hear the term "inject a script" or "inject SSH keys", OpenStack can't upload anything to instances and can't force instances to run scripts. It can only make scripts and other information available via the metadata server, which an instance accesses using a mechanism like cloud-init. Your best bet is to bake the scripts you want to run into the images in your cloud. Of course, if your cloud allows users to upload their own images, you need to rely on their cooperation.

Rather than trying to use scripts inside instances, you could investigate if OpenStack can manage your IP addresses and DNS records outside of instances.

For example, Neutron features IPAM integration, though I don't know whether it has a driver for your particular IPAM solution and to what extent it addresses your problem. You could start here: https://docs.openstack.org/neutron/la..., though this page is unlikely to reflect the most recent status.

OpenStack has a service for DNS integration named Designate. You can make it create DNS records automatically whenever an instance gets an external IP address. Its documentation is at https://docs.openstack.org/designate/....

edit flag offensive delete link more

Comments

And for cmdb a script that lists all instances via the APIs and then add instances to the CMDB should be doable too.

martbhell b gravatar imagemartbhell b ( 2018-03-24 13:58:31 -0500 )edit

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

Stats

Asked: 2018-03-23 16:42:40 -0500

Seen: 140 times

Last updated: Mar 25 '18