libvirt-centos9.pkr.hcl (1268B)
1 2 variable "manifest" { 3 type = string 4 default = "manifest.json" 5 } 6 7 source "qemu" "centos9" { 8 accelerator = "kvm" 9 boot_command = ["<up><tab> rd.shell ip=dhcp inst.cmdline inst.ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/ks-9.cfg<enter>"] 10 boot_wait = "5s" 11 cpu_model = "host" 12 disk_interface = "virtio" 13 disk_size = "14000" 14 memory = "4096" 15 net_device = "virtio-net" 16 format = "qcow2" 17 http_directory = "config" 18 iso_checksum = "file:https://linuxsoft.cern.ch/centos-stream/9-stream/BaseOS/x86_64/iso/CentOS-Stream-9-latest-x86_64-boot.iso.SHA256SUM" 19 iso_url = "https://linuxsoft.cern.ch/centos-stream/9-stream/BaseOS/x86_64/iso/CentOS-Stream-9-latest-x86_64-boot.iso" 20 shutdown_command = "echo 'packer' | sudo -S shutdown -P now" 21 ssh_timeout = "20m" 22 ssh_username = "root" 23 ssh_password = "root" 24 vm_name = "centos9-${formatdate("YYYYMMDD-hhmmss", timestamp())}" 25 output_directory = "centos9-${formatdate("YYYYMMDD-hhmmss", timestamp())}" 26 } 27 28 build { 29 sources = ["source.qemu.centos9"] 30 31 provisioner "shell" { 32 script = "scripts/cloud-config.sh" 33 } 34 35 post-processor "manifest" { 36 output = "${var.manifest}" 37 strip_path = true 38 } 39 }