packer-xcp-ng/examples/centos/centos8-local.pkr.hcl
2023-02-14 15:48:24 +01:00

82 lines
2.1 KiB
HCL

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_remote_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_remote_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_remote_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" "centos8-local" {
iso_checksum = "aaf9d4b3071c16dbbda01dfe06085e5d0fdac76df323e3bbe87cce4318052247"
iso_checksum_type = "sha1"
iso_url = "http://mirrors.ocf.berkeley.edu/centos/8.3.2011/isos/x86_64/CentOS-8.3.2011-x86_64-dvd1.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-centos8-local-${local.timestamp}"
vm_description = "Build started: ${local.timestamp}\n This was installed from the dvd"
vm_memory = 4096
disk_size = 4096
http_directory = "examples/http/centos8"
boot_command = ["<tab> text ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/ks-centos8-local.cfg<enter><wait>"]
boot_wait = "10s"
ssh_username = "root"
ssh_password = "centos"
ssh_wait_timeout = "10000s"
output_directory = "packer-centos8-local"
keep_vm = "always"
}
build {
sources = ["xenserver-iso.centos8-local"]
}