如何在不重新启动的情况下重新运行cloud-init [英] How to re-run cloud-init without reboot

查看:786
本文介绍了如何在不重新启动的情况下重新运行cloud-init的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用openstack通过"nova boot"命令创建VM.我的映像启用了cloud-init.我传递了一个--user-data脚本,该脚本是bash shell格式,可在VM启动期间运行cloud-init.这一切都成功地发生了. 现在,我的用例是重新运行cloud-init以执行相同的用户数据脚本,而无需重新启动VM.我看到了/usr/bin/cloud-init选项,它们确实谈论了运行特定模块的问题,但是没有任何方法能够使它执行相同的用户数据脚本.如何实现呢?任何帮助,将不胜感激.

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.

推荐答案

要重置cloud-init,您需要执行rm -rf /var/lib/cloud/instances.

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

然后重新运行cloud-init start,它将再次运行完整的启动脚本过程.

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

这篇关于如何在不重新启动的情况下重新运行cloud-init的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆