-
-
Save alandsidel/8fdad97624aa34087a1d3b11d0c9b6f2 to your computer and use it in GitHub Desktop.
example packer file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
source "vsphere-iso" "standard" { | |
CPUs = "${var.pkr-cpu-num}" | |
RAM = "${var.vm-mem-size}" | |
RAM_reserve_all = "true" | |
boot_command = [ | |
"c<wait30>", | |
"linux /casper/vmlinuz", | |
" autoinstall", | |
" ip=\"::::${var.vm-name-standard}:eth0:dhcp\"", | |
" ds=\"nocloud-net;s=http://{{ .HTTPIP }}:{{ .HTTPPort }}/\"", | |
" net.ifnames=0", | |
" ---", | |
" net.ifnames=0", | |
"<enter>", | |
"initrd /casper/initrd<enter><wait5>", | |
"boot<enter>", | |
"<wait300>" | |
] | |
boot_wait = "2s" | |
cluster = "${var.cluster}" | |
convert_to_template = "true" | |
datacenter = "${var.datacenter}" | |
datastore = "${var.datastore_pkr}" | |
disk_controller_type = ["pvscsi"] | |
folder = "${var.folder}" | |
guest_os_type = "ubuntu64Guest" | |
http_port_min = 40000 | |
http_port_max = 41000 | |
// http_interface = "tun0" | |
http_bind_address = "192.168.122.23" | |
http_content = { | |
"/meta-data" = "" | |
"/user-data" = templatefile("user-data.tpl", { | |
ssh-public-key = "${local.ssh-public-key}" | |
ssh-username = "${local.ssh-username}" | |
ssh-pwhash = "${local.ssh-pwhash}" | |
hostname = "${var.vm-name-standard}" | |
}) | |
} | |
insecure_connection = "true" | |
iso_checksum = "${var.iso-checksum-type}:${var.iso-checksum}" | |
iso_urls = ["${var.iso-url}"] | |
network_adapters { | |
network = "${var.network}" | |
network_card = "vmxnet3" | |
} | |
password = local.vault_vc_pass | |
ssh_username = local.ssh-username | |
ssh_password = local.ssh-password | |
ssh_pty = "true" | |
storage { | |
disk_size = "${var.vm-disk-size-boot}" | |
disk_thin_provisioned = "false" | |
} | |
storage { | |
disk_size = "${var.vm-disk-size-standard}" | |
disk_thin_provisioned = "false" | |
} | |
username = local.vault_vc_user | |
vcenter_server = "${var.vcenter-server}" | |
vm_name = "${var.vm-name-standard}" | |
} | |
build { | |
sources = ["source.vsphere-iso.standard"] | |
provisioner "shell-local" { | |
inline = ["./provision.sh ${local.ssh-username} ${local.ssh-password} ${var.vm-name-standard}"] | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment