Ask Your Question
3

Calling batch script from cloudbase-init?

asked 2015-02-26 01:32:50 -0500

Bhim gravatar image

updated 2015-02-27 18:11:22 -0500

smaffulli gravatar image

Hello,

I want to run a batch script which perform certain tasks after instance is build, I want to run it as the last step of cloudbase-init. It can be easily done in linux with runcmd in cloudinit.conf but I struggling with how to do it in Windows. I don't want to paste it in horizon (user input) at the time of instance creation but want to call it from inside. Would be great if you can suggest a way to do it?

Thanks for your help.

Regards, Bhim

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
2

answered 2015-03-02 08:06:28 -0500

alexpilotti gravatar image

All you need to do is to add a user_data script, where the first line will determine the type of script, followed by the actual script itself:

CMD/BAT:

rem cmd

Powershell:

#ps1_sysnative

Bash:

#!

Examples:

rem cmd
echo "Hello OpenStack instance" > C:\test.txt

or

#ps1_sysnative
Set-Content -Path "C:\test.txt" -Value "Hello OpenStack instance"

For additional details:

https://github.com/stackforge/cloudba...

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

2 followers

Stats

Asked: 2015-02-26 01:32:50 -0500

Seen: 2,608 times

Last updated: Mar 02 '15