Packer Proxmox

Aus Xinux Wiki
Zur Navigation springen Zur Suche springen

Webserver

KVM Host

Packer Build File

  • ~/packer/debian-kvm.json
{
  "variables": {
    "username": "root@pam",
    "password": "Streng-Geheim"
  },
  "builders": [
    {
      "type": "proxmox",
      "proxmox_url": "https://daisy.xinux.org:8006/api2/json",
      "insecure_skip_tls_verify": true,
      "username": "{{user `username`}}",
      "password": "{{user `password`}}",

      "node": "daisy",
      "network_adapters": [
        {
          "bridge": "vmbr0",
          "vlan_tag"  : "85"
        }
      ],
      "disks": [
        {
          "type": "virtio",
          "disk_size": "5G",
          "format": "qcow2",
          "storage_pool": "geldspeicher",
          "storage_pool_type": "nfs"
        }
      ],

      "iso_file": "geldspeicher:iso/debian-11.3.0-amd64-DVD-1.iso",
      "http_directory": "config",
      "boot_wait": "10s",
      "boot_command": [
        "<esc><wait>",
        "install <wait>",
        "/install/vmlinuz<wait>",
        " initrd=/install/initrd.gz",
        " auto-install/enable=true",
        " debconf/priority=critical",
        " preseed/url=http://daisy.xinux.org/preseed/debian11/preseed.cfg <wait>",
        "debian-installer=de_DE.UTF-8 <wait>",
        "auto <wait>",
        "locale=de_DE.UTF-8 <wait>",
        "kbd-chooser/method=us <wait>",
        "keyboard-configuration/xkb-keymap=de <wait>",
        "fb=false <wait>",
        "debconf/frontend=noninteractive <wait>",
        "console-setup/ask_detect=false <wait>",
        "console-keymaps-at/keymap=de <wait>",
        "grub-installer/bootdev=/dev/vda <wait>",
        "<enter><wait>"
      ],
      "memory": "4096",
      "ssh_username": "vagrant",
      "ssh_timeout": "15m",
      "ssh_password": "vagrant",
      "unmount_iso": true,
      "template_name": "debian-11.3.0",
      "template_description": "Debian 11.3.0, generated on {{ isotime \"2022-04-04T15:04:05Z\" }}"
    }
  ]
}

Bild Vorgang starten

  • packer build debian11-proxmox.json
proxmox: output will be in this color.

==> proxmox: Creating VM
==> proxmox: No VM ID given, getting next free from Proxmox
==> proxmox: Starting VM
==> proxmox: Starting HTTP server on port 8306
==> proxmox: Waiting 10s for boot
==> proxmox: Typing the boot command
==> proxmox: Waiting for SSH to become available...

Ergebnis

  • file output-qemu/packer-qemu
output-qemu/packer-qemu: QEMU QCOW2 Image (v3), 5242880000 bytes