Feature #2703
closedCreate vmware virtual machines by cloning a template
Description
At the moment vmware vm's created by foreman have a very basic virtual machine hardware configuration.
This means that a created vm is not optimized for our environment and is not making use of the best drivers/virtual-hardware that best suits an installed OS.
If we can use templates as a base for a new vm then we can tweak the template as desired and clone it to a vm with all the specs we need.
It would be nice if the cpu, mem, disk configurations in foreman would be applied against the clone of the template upon vm creation.
This way we could create a few needed templates and use them to create different virtual machines based om installed OS and architecture.
Updated by Ronny M about 11 years ago
Not sure if needed but below a script that I created (with help of google) that uses fog to clone a vm with almost everything that I need or like to have.
I'm still trying to find a way to change the disk sizes of the newly created vm.
I assume it might be possible to change the "New Host" UI and feed the network, cpu, mem and location choices based on a selected template or vm and use a vm_clone fog command instead of an vm_create command with foreman.
#!/usr/bin/env ruby
require 'fog'
require 'pp'
connection = Fog::Compute[:vsphere]
puts "Connected to #{connection.vsphere_server} as #{connection.vsphere_username} (API version #{connection.vsphere_rev})"
options = {
'datacenter' => 'CJIB',
'template_path' => '/rhel6_clone',
'name' => 'rhel6_vm',
'power_on' => true,
'memoryMB' => '1024',
'network_label' => 'dvportgroup-255',
'network_adapter_device_key' => '4000',
'numCPUs' => 2,
'resource_pool' => ['thuis','resource pool 2'],
'datastore' => 'datastore1',
'dest_folder' => 'RHEL/Servers',
'wait' => true,
}
new_vm=connection.vm_clone(options)
pp new_vm
Updated by Ronny M about 11 years ago
I'm also thinking of trying to do this with foreman hooks but not yet sure if that will produce the desired result.
Updated by Dominic Cleal about 11 years ago
- Is duplicate of Feature #2438: Ability to deploy hosts from vmware templates added
Updated by Dominic Cleal about 11 years ago
- Description updated (diff)
- Status changed from New to Duplicate
Moving to #2438 as it's got more votes.