Feature #2703

Create vmware virtual machines by cloning a template

Added by Ronny M almost 6 years ago. Updated almost 4 years ago.

Compute resources
Target version:
Bugzilla link:
Pull request:
Team Backlog:
Fixed in Releases:
Found in Releases:


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.

Related issues

Is duplicate of Foreman - Feature #2438: Ability to deploy hosts from vmware templatesClosed2013-04-29


#1 Updated by Dominic Cleal almost 6 years ago

  • Category set to Compute resources

#2 Updated by uncle billy almost 6 years ago

+1 for this feature!

#3 Updated by Ronny M almost 6 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,


pp new_vm

#4 Updated by Ronny M almost 6 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.

#5 Updated by Dominic Cleal over 5 years ago

  • Is duplicate of Feature #2438: Ability to deploy hosts from vmware templates added

#6 Updated by Dominic Cleal over 5 years ago

  • Description updated (diff)
  • Status changed from New to Duplicate

Moving to #2438 as it's got more votes.

Also available in: Atom PDF