pivotal-cf/packer-builder-vsphere

Name: packer-builder-vsphere

Owner: Pivotal Cloud Foundry

Description: Packer plugin for remote builds on VMware vSphere

Created: 2018-05-18 22:00:33.0

Updated: 2018-05-18 22:00:35.0

Pushed: 2018-05-21 19:02:45.0

Homepage:

Size: 229

Language: Go

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Team project Github All Releases TeamCity build status

Packer Builder for VMware vSphere

This a plugin for HashiCorp Packer. It uses native vSphere API, and creates virtual machines remotely.

Usage
Minimal Example

uilders": [
{
  "type": "vsphere",

  "vcenter_server": "vcenter.domain.com",
  "username": "root",
  "password": "secret",

  "template": "ubuntu",
  "vm_name":  "vm-1",
  "host":     "esxi-1.domain.com",

  "ssh_username": "root",
  "ssh_password": "secret"
}

rovisioners": [
{
  "type": "shell",
  "inline": [ "echo hello" ]
}


Parameters

Connection:

Location:

Hardware customization:

Provisioning:

Post-processing:

Complete Example

ariables": {
"vsphere_password": "secret",
"guest_password": "secret"


uilders": [
{
  "type": "vsphere",

  "vcenter_server": "vcenter.domain.com",
  "username": "root",
  "password": "{{user `vsphere_password`}}",
  "insecure_connection": true,
  "datacenter": "dc1",

  "template": "folder/ubuntu",
  "vm_name": "vm-1",
  "folder": "folder1/folder2",
  "host": "folder/esxi-1.domain.com",
  "resource_pool": "pool1/pool2",
  "datastore": "datastore1",
  "linked_clone": true,

  "CPUs": 2,
  "CPU_reservation": 1000,
  "CPU_limit": 2000,
  "RAM": 8192,
  "RAM_reservation": 2048,

  "ssh_username": "root",
  "ssh_password": "{{user `guest_password`}}",

  "shutdown_command": "echo '{{user `guest_password`}}' | sudo -S shutdown -P now",
  "shutdown_timeout": "5m",
  "create_snapshot": true,
  "convert_to_template": true
}


rovisioners": [
{
  "type": "shell",
  "environment_vars": [
    "DEBIAN_FRONTEND=noninteractive"
  ],
  "execute_command": "echo '{{user `guest_password`}}' | {{.Vars}} sudo -ES bash -eux '{{.Path}}'",
  "inline": [
    "apt-get install -y zip"
  ]
}



This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.