Master clone from vmware template

I managed to start the starter, and I can automatically deploy the virtual machines in my vcenter and then configure them with a puppet.

In any case, I received a requirement to clone virtual machines from templates. I came up with the following function request, which has not yet been implemented: http://projects.theforeman.org/issues/2438

I am really happy with webgui and the whole implementation - so I would like to get some tips to ponder this - perhaps to invoke a script somewhere to clone rather than deploy again? Is it possible to customize the build process in mastery to do this? Or maybe there is already a script for deployment?

If this is not possible at all, is there any other tool you can recommend?

Thanks a lot for your help!

+4
source share
1 answer

That the function request was partially implemented in command 1.5. You can clone from another virtual machine, but not with a template.

A related issue has added a script that makes a clone from the template:

#!/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
+1
source

Source: https://habr.com/ru/post/1533320/


All Articles