Go to file
Elizaveta Tretyakova e394b27a21 Update README.md 2017-06-24 02:19:44 +03:00
docker fix Dockerfile 2017-05-16 08:49:32 +03:00
.gitignore fix Dockerfile 2017-05-16 08:49:32 +03:00
README.md Update README.md 2017-06-24 02:19:44 +03:00
artifact.go Builder (#2) 2017-05-09 17:23:57 +03:00
build.sh Installation scripts 2017-05-15 00:25:50 +03:00
builder.go Added template conversion (#18) 2017-06-13 14:11:41 +03:00
config.go Added template conversion (#18) 2017-06-13 14:11:41 +03:00
docker-compose.yml Installation scripts 2017-05-15 00:25:50 +03:00
glide.yaml Update glide.yaml 2017-05-19 08:50:59 +03:00
main.go Builder (#2) 2017-05-09 17:23:57 +03:00
step_clone_vm.go Adding linked clones (#17) 2017-06-12 01:45:25 +03:00
step_configure_hw.go Added template conversion (#18) 2017-06-13 14:11:41 +03:00
step_post_process.go Added template conversion (#18) 2017-06-13 14:11:41 +03:00
step_run.go Builder (#2) 2017-05-09 17:23:57 +03:00
step_shutdown.go Added template conversion (#18) 2017-06-13 14:11:41 +03:00

README.md

packer-builder-vsphere

Usage

  • Download the plugin from the Releases page
  • Install the plugin, or simply save it into the working directory together with a configuration file; you may create your own configuration file or take the one given below (remember to put your real values for names, passwords, url and host)
template.json

{
   "builders": [
      {
         "type": "vsphere",
         
         "url":          "https://your.lab.addr/",
         "username":     "username",
         "password":     "secret",
         
         "ssh_username": "ssh_username",
         "ssh_password": "ssh_secret",
         
         "template": "source_vm_name",
         "vm_name":  "clone_name",
         "host":     "172.16.0.1"
      }
   ]
}

(host is for target host)

  • Run:
$ packer build template.json

Builder parameters

Required parameters:

  • username
  • password
  • template
  • vm_name
  • host

Optional parameters:

  • Destination parameters:
    • resource_pool
    • datastore
  • Hardware configuration:
    • cpus
    • ram
    • shutdown_command
  • ssh_username
  • ssh_password
  • dc_name (source datacenter)
  • Post-processing:
    • linked_clone
    • to_template

See an example below:

{
    "builders": [
        {
            "type": "vsphere",

            "url": "https://your.lab.addr/",
            "username": "username",
            "password": "secret",

            "ssh_username": "ssh_username",
            "ssh_password": "ssh_secret",

            "template": "template_name",
            "vm_name": "clone_name",
            "host": "172.16.0.1",
            "linked_clone": true,
            "to_template": true,

            "RAM": "1024",
            "cpus": "2",
            "shutdown_command": "echo 'ssh_secret' | sudo -S shutdown -P now"
        } 
    ],
    "provisioners": [
        {
              "type": "shell",
              "inline": ["echo foo"]
        }
    ]
}

where vm_name, RAM, cpus and shutdown_command are parameters of the new VM. Parameters ssh_*, dc_name (datacenter name) and template (the name of the base VM) are for the base VM, on which you are creating the new one (note that VMWare Tools should be already installed on this template machine). vm_name and host (describe the name of the new VM and the name of the host where we want to create it) are required parameters; you can also specify resource_pool (if you don't, the builder will try to detect the default one) and datastore. url, username and password are your vSphere parameters.

Progress bar

You can find it here as well.

  • hardware customization of the new VM (cpu, ram)
  • clone from template (not only from VM)
  • clone to alternate host, resource pool and datastore
  • enable linked clones
  • support Windows guest systems
  • enable VM-to-template conversion
  • tests
  • add a shutdown timeout
  • further hardware customization:
    • resize disks
    • ram reservation
    • cpu reservation