Skip to content
This repository has been archived by the owner on Sep 18, 2023. It is now read-only.

Ovftool import #8

Open
wants to merge 28 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
74c8e9d
adding vmware builder convert to ova to beter control the final disk …
Aug 13, 2015
98dac99
figuring out vmx->ova->vmx
Aug 13, 2015
989990d
working, but I don't like it. Switching to using ovftool
Aug 13, 2015
9440ca0
using ovftool to upload and register vm to better control vmdk type o…
Aug 17, 2015
d95db3a
removed testing bitsupload to another branch
Aug 18, 2015
f0e0b3d
Changed ova_dir pathing
Aug 18, 2015
88fab53
updated README.md
Aug 24, 2015
9b26a9f
Merge branch 'master' of https://github.com/Banno/packer-post-process…
Aug 24, 2015
89f964d
updated readme.md
Aug 24, 2015
0ab2dd5
added ability to control ova and vsphere template actions in packer json
Aug 25, 2015
db4f41e
readme.md updates
Aug 25, 2015
da85988
README.md updates.
Aug 26, 2015
35d8b2d
fixed virtualbox template upload, prepend tempalate- to templates
Aug 31, 2015
f6bffbe
output_artifact_type
Sep 3, 2015
2d18ce2
fixed output_artifact_type
Sep 3, 2015
a85c6b6
merged with remote master
Sep 3, 2015
917bd46
readme.md updates
Sep 3, 2015
2fd0a90
readme.md updates
Sep 3, 2015
69127a3
readme.md updates
Sep 4, 2015
6855333
readme.md updates
Sep 4, 2015
488558b
fix tabs
Jan 5, 2016
3638920
Update README.md
daxgames Mar 5, 2016
30915fd
Fixed dual setting of p.config.DiskMode defaults that caused build fa…
Jun 20, 2016
e9bb6e3
made ui message more verbose
Jun 20, 2016
58861a7
sync with origin
Jun 20, 2016
54d6956
synced with upstream
Jun 20, 2016
f55c232
made ui message more verbose
Jun 20, 2016
6a467fe
moved ova creation ahead of template upload, not forcing prepend of '…
Jun 21, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
98 changes: 63 additions & 35 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# packer-post-processor-vsphere-ova

This post-processor will upload a VMDK and vmware template to a datastore through VSphere 5.5
This post-processor will upload vmware template to a datastore through VSphere 5.5 and/or optionally create an ova file locally.

## Prerequisites

Expand All @@ -18,59 +18,92 @@ Notes:

## Installation

Pull the repository and compile the code with ```go build```
Pull the repository and compile the code with ```go build``` then copy it to your Packer install directory. You can also just type ```go install .``` if your Packer binaries are in '$GOPATH/bin'.

Add

Make sure that the directory which contains the packer-post-processor-vsphere-ova executable is your PATH environmental variable (see http://www.packer.io/docs/extend/plugins.html -> Installing Plugins)

## Usage

NOTE: For Virtualbox builders only, you also will need ```"format": "ova"``` in your virtualbox-iso builder section of your packer template.

### Make a vSphere Template - The default behavior.
Add the following, filled out correctly to your post-processors and you should end up with a new template registered on your cluster.

1. It uploads and registers the virtual machine using 'ovftool' in the 'Templates' folder
1. It marks the uploaded virtual machine as a template.

Add to your packer json file:

```
{
"post-processors": {
"vsphere-ova": "packer-post-processor-vsphere-ova"
}
}
"post-processors": [
{
"type": "vsphere-ova",
"host":"vcenter_host",
"datacenter":"datacenter_name",
"cluster":"cluster",
"username":"my_username",
"password":"my_password",
"datastore": "datastore_name"
}
]
```

to your packer configuration (see: http://www.packer.io/docs/other/core-configuration.html -> Core Configuration)
### Make a Local OVA File
Add the following, filled out correctly to your post-processors and you should end up with an ova file in ./ova/[builder_type].

Make sure that the directory which contains the packer-post-processor-vsphere-ova executable is your PATH environmental variable (see http://www.packer.io/docs/extend/plugins.html -> Installing Plugins)
1. Export an OVA file in ./ova/[builder_type].

## Usage
Add the following, filled out correctly to your post-processors and you should end up with `packer-virutalbox-timestamp-vm` registered on your cluster as a template.
Add to your packer json file:

I'm not sure if a release of Packer with SCSI support has been released yet, but you can create a virtualbox with a SCSI drive using Packer for maximum performance on your VMWare setup.
```
"post-processors": [
{
"type": "vsphere-ova",
"output_artifact_type:" "ova"
}
]
```

There is some wierdness with how this works:
### Make a both vSphere Template and a Local OVA file
Add the following, filled out correctly to your post-processors and you should end up with a new template registered on your cluster and an ova file in ./ova/[builder_type].

1. It uploads a virtual machine
2. It registers a virtual machine
3. It clones the virtual machine (it complains about invalid device backing
without this)
4. It powers on the cloned virtual machine
5. It SLEEPS for 2ish minutes while we wait for power on to complete
6. It powers off the cloned virtual machine
7. It marks the cloned virtual machine as a template.
8. You end up with a registered template of the vm name with "-vm" appended.
1. Uploads and registers the virtual maching using 'ovftool' in the 'Templates' folder
1. Marks the uploaded virtual machine as a template.
1. Export an OVA file in ./ova/[builder_type].

This is the statement you need to add to your packer json file:
Add to your packer json file:

```
"post-processors": [
{
"type": "vsphere-ova",
"host":"vcenter_host",
"datacenter":"datacenter_name",
"cluster":"cluster",
"username":"my_username",
"password":"my_password",
"datastore": "datastore_name",
"vm_folder":"folder_on_datastore",
"vm_network":"vmware_network_name"
"output_artifact_type:" "ova_template"
}
]
```

You also will need ```"format": "ova"``` in your virtualbox-iso builder for this to function.
### Specifying the output artifact type

NOTE: This will produce the default behavior described above, you can avoid steps 3-6 if you remove the Floppy, Optical Drive, and Ethernet devices prior to upload. See below for how to do this.
Add ```"output_artifact_type":"ova|template|ova_template"``` to the post-processor config in your packer template. 'output_artifact_type' Default: "template"

* ova Produces an OVA file in ./ova/[builder_type].
* template Uploads a template to the specified vSphere.
* ova_template Produces an OVA file in ./ova/[builder_type] and uploads a template to the specified vSphere.

### Specifying an alternate folder to hold the Template

Add ```"vm_folder":"folder_name"``` to the post-processor config in your packer template. 'folder_name' is realative to the Datacenter name. Default: "Templates"

### Specifying a specific virtual network to connect to

Add ```"vm_network":"vmware_network_name"``` to the post-processor config in your packer template. 'vmware_network_name' Default: "VM Network"

### Specifying a Virtual Hardware Version Before Uploading to Vsphere

Expand All @@ -81,15 +114,10 @@ Add ```"virtual_hardware_version": "n"``` to the post-processor config in your p
Add ```"remove_floppy": "true"``` to the post-processor config in your packer template.

### Removing the Ethernet0 Interface Before Uploading to Vsphere
NOTE: Do not use with 'vm_network'.

Add ```"remove_ethernet": "true"``` to the post-processor config in your packer template.
Add ```"remove_ethernet": "true"``` to the post-processor config in your packer template.

### Removing the Optical Drive Before Uploading to Vsphere

Add ```"remove_optical_drive": "true"``` to the post-processor config in your packer template.

### Avoiding Post-Processing Steps 3-6
Add ```"remove_floppy": "true", "remove_ethernet": "true", "remove_optical_drive": "true"``` to the post-processor config in your packer template.

NOTE: This makes the ```"vm_network": "vmware_network_name"``` parameter optional.

Loading