Ask Your Question
1

How can I make custom cloud-init script?

asked 2014-12-14 04:37:44 -0600

I followed Juno manual to create custom virtual machines that declared cloud-init script as mandatory part before I use image inside cloud, create glance image.

They mentioned requirements to virtual machines of different types that include procedure to resize original partition table to fit target vda disk and so on.

I wonder if I can use custom cloud-init script and where is good documentation how to write it?

Can I develop minimal cloud-init procedures that assign ip address only from specific dhcp server and do nothing more?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
2

answered 2014-12-14 11:06:56 -0600

updated 2014-12-31 04:19:04 -0600

For cloud-init scripts to work, basic condition is that since its a ubuntu package, it should be installed in the image (type apt-get install cloud-init to install). If you want to configure instance at boot time the Cloud-Init enables the support of several different input formats for user data

  1. shell scripts, that start with #!
  2. Cloud-config files that start with #cloud-config

Using Shell script

The following is the shell script for adding group

#!/bin/bash
groupadd abc

Using Cloud-init:

The following will set hostname to xyz on the instance

#cloud-config
hostname: xyz

Similarly you can go on adding lines to the scripts and achieve the desired functionality. Furthermore see cloud-config and this.

edit flag offensive delete link more

Comments

Thanks. I have read part regarding ubuntu image but missed cloud-config docs. And I think I can use configuration disk somehow.

szemtsov gravatar imageszemtsov ( 2014-12-15 07:14:48 -0600 )edit

well if the answer did help you, please accept it as answer and upvote it. thanks

Syed Awais Ali gravatar imageSyed Awais Ali ( 2014-12-15 11:35:39 -0600 )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: 2014-12-14 04:37:44 -0600

Seen: 1,936 times

Last updated: Dec 31 '14