How to re-run cloud-init without reboot

user3532850 picture user3532850 · Apr 14, 2014 · Viewed 34.5k times · Source

I am using openstack to create a VM using 'nova boot' command. My image is cloud-init enabled. I pass a --user-data script which is a bash shell format for cloud-init to run during VM boot up time. All this happens successfully. Now my use-case is to re-run cloud-init to execute the same user-data script without rebooting the VM. I saw /usr/bin/cloud-init options and they do talk about running specific modules but nothing is able to make it execute the same user-data script. How can this be achieved ? Any help would be appreciated.

Answer

benh57 picture benh57 · Apr 27, 2014

In order for cloud-init to reset, you need to execute rm -rf /var/lib/cloud/instances.

Then re run the cloud-init start and it will run the full boot script process again.