Ask Your Question

How to use puppet DSL with vsphere module?

asked 2015-09-11 05:30:34 -0600

Mr_Sharma gravatar image

updated 2015-09-11 10:58:38 -0600

GregLarkin gravatar image

I found very limited actions available with cloudprovisiner for vsphere so I started exploring puppet module for vsphere here:
But I am not getting how to use puppet DSL to create/provision a vm. Sample dsl code is:

vsphere_vm { '/opdx1/vm/eng/sample':
  ensure => running,
  source => '/opdx1/vm/eng/source',
  memory => 1024,
  cpus   => 1,

I am not getting how and where to use this code even given document do not explain it. Need clarification. Thanks.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2015-09-11 11:55:51 -0600

GregLarkin gravatar image

updated 2015-09-11 11:56:17 -0600

This module is intended to be used on a machine that you designate to control your VMware VMs in vCenter. Did you configure module as noted here?

You'll have to create a class to include your vsphere_vm resources, then classify a node with that class, and the node will connect to vCenter to manage your VMs during its Puppet run.

edit flag offensive delete link more


Hi Greg, Thanks. Actually I haven't started on given module due to licencing terms. However, I am going through the docs to get overall idea. For our orchestrator vsphere_vm cmd is very handy and I am looking for post provisioning functions to be included in the same cmd(as we do with chef knife)

Mr_Sharma gravatar imageMr_Sharma ( 2015-09-14 01:22:26 -0600 )edit

Ok, please post back here once you start implementing anything if you run into trouble.

GregLarkin gravatar imageGregLarkin ( 2015-09-14 13:12:49 -0600 )edit

Sure. Thanks.

Mr_Sharma gravatar imageMr_Sharma ( 2015-09-14 14:52:49 -0600 )edit

Hi Greg, I am ready with all setup. Can you please point me how to add configuration at runtime. E.g. I want to create a vm using "puppet resource vsphere_vm" and at the same time need to pass a module say "tomcat" to be installed right after vm is ready. Can we do that in a single command line?

Mr_Sharma gravatar imageMr_Sharma ( 2015-10-26 06:22:08 -0600 )edit

I'm not an expert with that module, but check the documentation for the "create_command" attribute. Looks like you can invoke a command after the VM is ready. If you can populate the VM with a Puppet manifest, you can call "puppet apply" on it to install Tomcat. There may be a better way, though.

GregLarkin gravatar imageGregLarkin ( 2015-10-26 19:24:55 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2015-09-11 05:30:34 -0600

Seen: 209 times

Last updated: Sep 11 '15