Ask Your Question
0

End to end vm provisioning with vSphere module

asked 2015-10-27 05:21:00 -0600

rajeevsharma gravatar image

Hi, Here I am looking for a complete solution not just an answer. For my end to end solution I want to use CLI instead of PE console. Following cmd is used to provision a VM but I am looking for additional stuffs which may come along with the same command or a script.

puppet resource vsphere_vm ......

  1. Can we register the node with PE server in the same command when VM gets created?
  2. Can we define classes/modules should be applied as soon as the VM is up?

The idea behind my question is to create a vm, register with puppet server, apply default modules(modules could be selected from existing one). These operation is supposed to be wrapped in a single command or script.

I am not able to find these answers anywhere even puppetlabs doc do not explain module CLI nicely. Any help would be appreciated.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2015-10-27 16:29:48 -0600

GregLarkin gravatar image

updated 2015-10-27 16:30:12 -0600

Check out the create_command attribute provided by the vsphere_vm type. You can use that attribute to fire off some commands inside the VM once it has booted. The first thing you can do is inject a YAML file containing a trusted fact to determine the role of the new machine. Then call the PE Agent simplified installer and either manually sign the certificate request or configure your master for auto-signing.

Assuming your code uses the value of the trusted role fact, the next PE Agent run will apply all of the classes associated with the node's role.

Here are some references for you:

https://docs.puppetlabs.com/puppet/latest/reference/sslattributesextensions.html

https://docs.puppetlabs.com/puppet/latest/reference/langfactsandbuiltinvars.html#trusted-facts

edit flag offensive delete link more

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

Stats

Asked: 2015-10-27 05:21:00 -0600

Seen: 71 times

Last updated: Oct 27 '15