Ask Your Question
1

How to control execution time of cloud-init

asked 2015-02-07 02:02:47 -0500

kevin_zhu gravatar image

I have a requirement that I need my VM to be configured by our IT internal tools in the first boot process BEFORE cloud-init starts to work such as configuring the user-data from meta-data service for vm customization. Therefore, is there a way we can control that time point when we can single the cloud-init service start to work after our own configuration is finished?

Thanks very much in advance!

edit retag flag offensive close merge delete

1 answer

Sort by » oldest newest most voted
2

answered 2015-02-07 09:20:54 -0500

larsks gravatar image

In general, cloud-init is started like any other service on your system, via whichever init mechanism (systemd, upstart, sysvinit, etc) is in use. This means you can modify at what point in the boot process runs in the same way you would do that for any other service:

  • For sysvinit, have your internal tools start with a lower number than cloud-init. That is, if cloud-init is:

    # ls *cloud*
    S50cloud-init-local
    S51cloud-init
    S52cloud-config
    S53cloud-final
    

    Then you can install your custom startup script as anything below S50 (e.g., S40our-custom-tolls).

  • For systemd, you can give your internal tools a Before=cloud-init-local directive, which should get your tools to run before any of the cloud-init services:

    [Unit]
    Before=cloud-init-local.service
    
  • For upstart, you're on your own, but the process is going to be similar.

All of this assumes that you are building your own images that contain both cloud-init and your local tools.

edit flag offensive delete link more

Comments

Larsks,

Very helpful and really appreciated!

kevin_zhu gravatar imagekevin_zhu ( 2015-02-10 21:29:47 -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: 2015-02-07 02:02:47 -0500

Seen: 510 times

Last updated: Feb 07 '15