linux – 我可以在不使用openstack或EC2的情况下运行cloud-init
我创建了一个基于KVM的多个
Linux主机的环境.
我正在使用virt-manager创建不同的虚拟机,而我正在使用Linux网桥在不同主机中的虚拟机之间创建连接. 现在,我想拥有一个自动配置服务器,以便我的虚拟机可以根据每个虚拟机的唯一ID自动配置其名称,IP地址,运行一些脚本等.是否可以在非openstack环境中复制某种cloud-init设置? 我尝试以下列方式使用cloud-init数据源NoCloud.首先,我在VM中安装了cloud-init并配置了cloud.cfg: datasource: NoCloud datasource_list: [ NoCloud ] disable_ec2_metadata: True 然后,我创建了一个用户数据文件和元数据文件,其中包含以下内容: 用户数据: #cloud-config hostname: prueba password: passw0rd chpasswd: { expire: False } ssh_pwauth: True 元数据: instance-id: iid-local01 local-hostname: prueba 然后,我生成了一个iso文件: genisoimage -output seed.iso -volid cidata -joliet -rock user-data meta-data 最后,我已将磁盘连接到VM并启动它.这是XML的相关部分: <disk type='file' device='disk'> <driver name='qemu' type='raw'/> <source file='/opt/images/seed.iso'/> <backingStore/> <target dev='vdb' bus='virtio'/> <alias name='virtio-disk1'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/> </disk> 当VM启动时,它会说: 2015-05-12 12:12:40,394 - util.py[WARNING]: Getting data from <class 'cloudinit.sources.DataSourceNoCloud.DataSourceNoCloudNet'> failed * Stopping Read required files in advance (for other mountpoints) [ OK ] * Stopping Read required files in advance (for other mountpoints) [ OK ] * Stopping Read required files in advance (for other mountpoints) [ OK ] 2015-05-12 12:12:48,808 - url_helper.py[WARNING]: Calling 'http://169.254.169.254/2009-04-04/meta-data/instance-id' failed [3/120s]: request error [HTTPConnectionPool(host='169.254.169.254',port=80): Max retries exceeded with url: /2009-04-04/meta-data/instance-id (Caused by <class 'socket.error'>: [Errno 113] No route to host)] 有关如何使其工作的任何建议? 解决方法
当然. Cloud-init不需要网络元数据服务(如EC2和OpenStack提供的服务)才能运行.它将很乐意从本地CD-ROM设备读取配置信息;例如,参见this document的“登录到原子机”部分,其中描述了如何创建必要的文件系统. 这是在cloud-init文档中记录的here. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |