update Readme

This commit is contained in:
Michael Kuzmin 2017-06-27 12:07:10 +03:00
parent 28efdd4acc
commit 12e7a3f42b

View File

@ -1,60 +1,72 @@
# packer-builder-vsphere # Packer Builder for VMware vSphere
This builder uses native vSphere API, and creates virtual machines remotely.
- VMware Player is not required
- Builds are incremental, VMs are not created from scratch but cloned from base templates - similar to [amazon-ebs](https://www.packer.io/docs/builders/amazon-ebs.html) builder
- Official vCenter API is used, no ESXi host [modification](https://www.packer.io/docs/builders/vmware-iso.html#building-on-a-remote-vsphere-hypervisor) is required
## Usage ## Usage
* Download the plugin from the [Releases](https://github.com/jetbrains-infra/packer-builder-vsphere/releases) page * Download the plugin from [Releases](https://github.com/jetbrains-infra/packer-builder-vsphere/releases) page
* [Install](https://www.packer.io/docs/extending/plugins.html#installing-plugins) 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`) * [Install](https://www.packer.io/docs/extending/plugins.html#installing-plugins) the plugin, or simply put it into the same directory with configuration files
``` json
template.json
## Minimal Example
```json
{ {
"builders": [ "builders": [
{ {
"type": "vsphere", "type": "vsphere",
"url": "https://your.lab.addr/", "url": "https://vcenter.domain.com/sdk",
"username": "username", "username": "root",
"password": "secret", "password": "secret",
"ssh_username": "ssh_username", "template": "ubuntu",
"ssh_password": "ssh_secret", "vm_name": "vm-1",
"host": "esxi-1.domain.com",
"template": "source_vm_name", "ssh_username": "root",
"vm_name": "clone_name", "ssh_password": "secret"
"host": "172.16.0.1" }
],
"provisioners": [
{
"type": "shell",
"inline": [ "echo hello" ]
} }
] ]
} }
``` ```
(`host` is for target host)
* Run:
```
$ packer build template.json
```
## Builder parameters ## Parameters
### Required parameters: ### Required
* `url`
* `username` * `username`
* `password` * `password`
* `template` * `template`
* `vm_name` * `vm_name`
* `host` * `host`
### Optional parameters: * `ssh_username`
* Destination parameters: * `ssh_password`
### Optional
Destination:
* `dc_name` (source datacenter)
* `resource_pool` * `resource_pool`
* `datastore` * `datastore`
* Hardware configuration: * `linked_clone`
Hardware customization:
* `cpus` * `cpus`
* `ram` * `ram`
* `shutdown_command` * `shutdown_command`
* `ssh_username`
* `ssh_password` Post-processing:
* `dc_name` (source datacenter)
* Post-processing:
* `linked_clone`
* `create_snapshot` * `create_snapshot`
* `convert_to_template` * `convert_to_template`
See an example below: ## Complete Example
```json ```json
{ {
"builders": [ "builders": [
@ -93,20 +105,3 @@ Parameters `ssh_*`, `dc_name` (datacenter name) and `template` (the name of the
on which you are creating the new one (note that VMWare Tools should be already installed on this template machine). 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`. `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. `url`, `username` and `password` are your vSphere parameters.
## Progress bar
You can find it [here](https://github.com/LizaTretyakova/packer-builder-vsphere/projects/1) as well.
- [x] hardware customization of the new VM (cpu, ram)
- [x] clone from template (not only from VM)
- [x] clone to alternate host, resource pool and datastore
- [x] enable linked clones
- [ ] support Windows guest systems
- [x] enable VM-to-template conversion
- [ ] tests
- [x] add a shutdown timeout
- [ ] further hardware customization:
* resize disks
* ram reservation
* cpu reservation