微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

ruby – 工头 – 从vmware模板克隆

我能够让工头运行,我能够自动将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

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐