Packer Proxmox

Aus Xinux Wiki
Version vom 5. April 2022, 13:31 Uhr von Thomas.will (Diskussion | Beiträge) (Die Seite wurde neu angelegt: „=Webserver= *Packer Webserver =KVM Host= ==Packer Build File== *~/packer/debian-kvm.json <syntaxhighlight lang=json> { "variables": { "username": "ro…“)
(Unterschied) ← Nächstältere Version | Aktuelle Version (Unterschied) | Nächstjüngere Version → (Unterschied)
Zur Navigation springen Zur Suche springen

Webserver

KVM Host

Packer Build File

  • ~/packer/debian-kvm.json
{
  "variables": {
    "username": "root@pam",
    "password": "123Stop-Xinux"
  },
  "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-qemu.json
qemu output will be in this color.

==> qemu: Retrieving ISO
    qemu: Found already downloaded, initial checksum matched, no download needed: http://daisy.xinux.org/isos/debian-11.3.0-amd64-netinst.iso
==> qemu: Creating hard drive...
==> qemu: Starting HTTP server on port 8603
==> qemu: Found port for communicator (SSH, WinRM, etc): 2970.
==> qemu: Looking for available port between 5900 and 6000 on 127.0.0.1
==> qemu: Starting VM, booting from CD-ROM
==> qemu: Overriding defaults Qemu arguments with QemuArgs...
==> qemu: Waiting 10s for boot...
==> qemu: Connecting to VM via VNC (127.0.0.1:5903)
==> qemu: Typing the boot command over VNC...

Packer-1.png

Abschluss der Installation

==> qemu: Using ssh communicator to connect: 127.0.0.1
==> qemu: Waiting for SSH to become available...
==> qemu: Connected to SSH!
==> qemu: Gracefully halting virtual machine...
    qemu:
    qemu: Wir gehen davon aus, dass der lokale Systemadministrator Ihnen die
    qemu: Regeln erklärt hat.  Normalerweise läuft es auf drei Regeln hinaus:
    qemu:
    qemu:     #1) Respektieren Sie die Privatsphäre anderer.
    qemu:     #2) Denken Sie nach, bevor Sie tippen.
    qemu:     #3) Mit großer Macht kommt große Verantwortung.
    qemu:
    qemu: [sudo] Passwort für vagrant:
==> qemu: Converting hard drive...
Build 'qemu' finished.

==> Builds finished. The artifacts of successful builds are:
--> qemu: VM files in directory: output-qemu

Ergebnis

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