Update the Ubuntu example to hcl and packer init
This commit is contained in:
parent
34779f1b85
commit
92ab62aca0
@ -1,46 +0,0 @@
|
|||||||
{
|
|
||||||
"variables": {
|
|
||||||
"sr_name": "",
|
|
||||||
"sr_iso_name": "",
|
|
||||||
"remote_host": "{{env `XAPI_HOST`}}",
|
|
||||||
"remote_username": "{{env `XAPI_USERNAME`}}",
|
|
||||||
"remote_password": "{{env `XAPI_PASSWORD`}}"
|
|
||||||
},
|
|
||||||
"builders": [
|
|
||||||
{
|
|
||||||
"type": "xenserver-iso",
|
|
||||||
"sr_name": "{{user `sr_name`}}",
|
|
||||||
"sr_iso_name": "{{user `sr_iso_name`}}",
|
|
||||||
"remote_host": "{{user `remote_host`}}",
|
|
||||||
"remote_username": "{{user `remote_username`}}",
|
|
||||||
"remote_password": "{{user `remote_password`}}",
|
|
||||||
"tools_iso_name": "guest-tools.iso",
|
|
||||||
"boot_command": [
|
|
||||||
"<esc><f6> autoinstall ds=nocloud-net;s=http://{{ .HTTPIP }}:{{ .HTTPPort }}/<enter><wait>",
|
|
||||||
"<f6><wait><esc><wait> autoinstall ds=nocloud-net;s=http://{{ .HTTPIP }}:{{ .HTTPPort }}/<enter><wait>"
|
|
||||||
],
|
|
||||||
"boot_wait": "10s",
|
|
||||||
"disk_size": 10960,
|
|
||||||
"http_directory": "examples/http/ubuntu-2004",
|
|
||||||
"iso_checksum": "443511f6bf12402c12503733059269a2e10dec602916c0a75263e5d990f6bb93",
|
|
||||||
"iso_checksum_type": "sha256",
|
|
||||||
"iso_url": "http://releases.ubuntu.com/20.04/ubuntu-20.04.1-live-server-amd64.iso",
|
|
||||||
"iso_name": "ubuntu-20.04.1-live-server-amd64.iso",
|
|
||||||
"vm_other_config": {
|
|
||||||
"conversionvm":"true"
|
|
||||||
},
|
|
||||||
"output_directory": "packer-ubuntu-2004-x86_64-xenserver",
|
|
||||||
"shutdown_command": "/sbin/shutdown",
|
|
||||||
"ssh_username": "testuser",
|
|
||||||
"ssh_password": "ubuntu",
|
|
||||||
"ssh_wait_timeout": "60000s",
|
|
||||||
"ssh_timeout": "60000s",
|
|
||||||
"vm_name": "packer-ubuntu-2004-x86_64",
|
|
||||||
"vm_description": "Build time: {{isotime}}",
|
|
||||||
"disk_size": "20000",
|
|
||||||
"vm_memory": "4096",
|
|
||||||
"keep_vm": "always",
|
|
||||||
"ssh_handshake_attempts": "10000"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
86
examples/ubuntu/ubuntu-2004.pkr.hcl
Normal file
86
examples/ubuntu/ubuntu-2004.pkr.hcl
Normal file
@ -0,0 +1,86 @@
|
|||||||
|
packer {
|
||||||
|
required_plugins {
|
||||||
|
xenserver= {
|
||||||
|
version = ">= v0.3.2"
|
||||||
|
source = "github.com/ddelnano/xenserver"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "remote_host" {
|
||||||
|
type = string
|
||||||
|
description = "The ip or fqdn of your XenServer. This will be pulled from the env var 'PKR_VAR_XAPI_HOST'"
|
||||||
|
sensitive = true
|
||||||
|
default = null
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "remote_password" {
|
||||||
|
type = string
|
||||||
|
description = "The password used to interact with your XenServer. This will be pulled from the env var 'PKR_VAR_XAPI_PASSWORD'"
|
||||||
|
sensitive = true
|
||||||
|
default = null
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "remote_username" {
|
||||||
|
type = string
|
||||||
|
description = "The username used to interact with your XenServer. This will be pulled from the env var 'PKR_VAR_XAPI_USERNAME'"
|
||||||
|
sensitive = true
|
||||||
|
default = null
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "sr_iso_name" {
|
||||||
|
type = string
|
||||||
|
default = ""
|
||||||
|
description = "The ISO-SR to packer will use"
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "sr_name" {
|
||||||
|
type = string
|
||||||
|
default = ""
|
||||||
|
description = "The name of the SR to packer will use"
|
||||||
|
}
|
||||||
|
|
||||||
|
locals {
|
||||||
|
timestamp = regex_replace(timestamp(), "[- TZ:]", "")
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
source "xenserver-iso" "ubuntu-2004" {
|
||||||
|
iso_checksum = "443511f6bf12402c12503733059269a2e10dec602916c0a75263e5d990f6bb93"
|
||||||
|
iso_checksum_type = "sha256"
|
||||||
|
iso_url = "http://releases.ubuntu.com/20.04/ubuntu-20.04.1-live-server-amd64.iso"
|
||||||
|
|
||||||
|
sr_iso_name = var.sr_iso_name
|
||||||
|
sr_name = var.sr_name
|
||||||
|
tools_iso_name = "guest-tools.iso"
|
||||||
|
|
||||||
|
remote_host = var.remote_host
|
||||||
|
remote_password = var.remote_password
|
||||||
|
remote_username = var.remote_username
|
||||||
|
|
||||||
|
vm_name = "packer-ubuntu-2004-${local.timestamp}"
|
||||||
|
vm_description = "Build started: ${local.timestamp}"
|
||||||
|
vm_memory = 4096
|
||||||
|
disk_size = 20000
|
||||||
|
|
||||||
|
http_directory = "examples/http/ubuntu-2004"
|
||||||
|
boot_command = [
|
||||||
|
"<esc><f6> autoinstall ds=nocloud-net;s=http://{{ .HTTPIP }}:{{ .HTTPPort }}/<enter><wait>",
|
||||||
|
"<f6><wait><esc><wait> autoinstall ds=nocloud-net;s=http://{{ .HTTPIP }}:{{ .HTTPPort }}/<enter><wait>"
|
||||||
|
]
|
||||||
|
boot_wait = "10s"
|
||||||
|
|
||||||
|
ssh_username = "testuser"
|
||||||
|
ssh_password = "ubuntu"
|
||||||
|
ssh_wait_timeout = "10m"
|
||||||
|
shutdown_command = "/sbin/shutdown"
|
||||||
|
|
||||||
|
output_directory = "packer-ubuntu-2004-iso"
|
||||||
|
keep_vm = "always"
|
||||||
|
}
|
||||||
|
|
||||||
|
build {
|
||||||
|
sources = ["xenserver-iso.ubuntu-2004"]
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user