ruby – 工头 – 从vmware模板克隆
发布时间:2020-12-17 02:06:11 所属栏目:百科 来源:网络整理
导读:我能够让工头运行,我能够自动将VM部署到我的vcenter,然后使用puppet配置它们. 无论如何,我得到了从模板克隆VM的要求.我遇到了以下似乎尚未实现的功能请求:http://projects.theforeman.org/issues/2438 我对webgui和整个实现非常满意 – 所以我希望得到一些
我能够让工头运行,我能够自动将VM部署到我的vcenter,然后使用puppet配置它们.
无论如何,我得到了从模板克隆VM的要求.我遇到了以下似乎尚未实现的功能请求:http://projects.theforeman.org/issues/2438 我对webgui和整个实现非常满意 – 所以我希望得到一些解决方法 – 可能是在某个地方调用脚本来克隆而不是再次部署? 如果这根本不可能 – 你可以推荐另一种工具吗? 非常感谢你的帮助! 解决方法
feature request已经在工头1.5中实施了一半.您可以从其他VM克隆,但不能从模板克隆.
链接的问题添加了一个脚本,从模板中执行克隆: #!/usr/bin/ruby require 'rubygems' require 'fog' require 'pp' credentials = { :provider => "vsphere",:vsphere_username => "myadminuser",:vsphere_password => "*********",:vsphere_server => "vcenter.example.com",:vsphere_ssl => true,:vsphere_expected_pubkey_hash => "89d0foof6e6aef34e1ed20ae04dffad48085355e6bfoo792e9435b5a4f1b3e9" } connection = Fog::Compute.new(credentials) puts "Connected to #{connection.vsphere_server} as #{connection.vsphere_username} (API version #{connection.vsphere_rev})" options = { 'datacenter' => 'Baltimore','template_path' => '/centos_6_4','power_on' => true,'memoryMB' => '1024','network_label' => '172.18.2.x','numCPUs' => 2,'datastore' => 'VM NFS Mount','wait' => true,'hostname' => 'tester','name' => 'Tester','customization_spec' => { 'domain' => 'example.com','ipsettings' => { 'ip' => '172.18.2.10','gateway' => ['172.18.2.1'],'subnetMask' => '255.255.255.0',},} puts "Deploying new VM from template. This may take a few minutes..." new_vm=connection.vm_clone(options) pp new_vm (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |