From ca10207b4a4ce667120147f94e5f2c25afe0a56d Mon Sep 17 00:00:00 2001 From: daniel Date: Tue, 2 Feb 2021 17:34:43 +0100 Subject: [PATCH] added local DVD install example --- examples/centos/centos8-local.pkr.hcl | 73 ++++++++++++++++++++++ examples/http/centos8/ks-centos8-local.cfg | 47 ++++++++++++++ 2 files changed, 120 insertions(+) create mode 100644 examples/centos/centos8-local.pkr.hcl create mode 100644 examples/http/centos8/ks-centos8-local.cfg diff --git a/examples/centos/centos8-local.pkr.hcl b/examples/centos/centos8-local.pkr.hcl new file mode 100644 index 0000000..5e508c8 --- /dev/null +++ b/examples/centos/centos8-local.pkr.hcl @@ -0,0 +1,73 @@ +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" "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 = [" text ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/ks-centos8-local.cfg"] + boot_wait = "10s" + + ssh_username = "root" + ssh_password = "centos" + ssh_wait_timeout = "10000s" + shutdown_command = "/sbin/shutdown" + + output_directory = "packer-centos8-local" + keep_vm = "always" +} + +build { + sources = ["xenserver-iso.centos8-local"] +} \ No newline at end of file diff --git a/examples/http/centos8/ks-centos8-local.cfg b/examples/http/centos8/ks-centos8-local.cfg new file mode 100644 index 0000000..a275dea --- /dev/null +++ b/examples/http/centos8/ks-centos8-local.cfg @@ -0,0 +1,47 @@ +eula --agreed +lang en-US.UTF-8 +keyboard --vckeymap='de' --xlayouts='de' +timezone Europe/Berlin + +cdrom + +text +skipx +firstboot --disable + +rootpw --plaintext centos + +firewall --enabled --ssh +selinux --enforcing + +# Installation logging level +logging --level=info + +network --bootproto=dhcp --device=eth0 --onboot=on + +# System bootloader configuration +bootloader --location=mbr +zerombr +clearpart --all + +# Disk partitioning information +part / --asprimary --fstype="ext4" --size=1024 --grow + + +%addon com_redhat_kdump --disable +%end + +%packages --ignoremissing --excludedocs +openssh-clients +sudo + +# unnecessary firmware +-aic94xx-firmware* +-alsa-* +-ivtv-* +-iwl*firmware +%end + +# Reboot after installation +reboot --eject +