Packer Proxmox: Unterschied zwischen den Versionen

Aus Xinux Wiki
Zur Navigation springen Zur Suche springen
(Die Seite wurde neu angelegt: „=Webserver= *Packer Webserver =KVM Host= ==Packer Build File== *~/packer/debian-kvm.json <syntaxhighlight lang=json> { "variables": { "username": "ro…“)
 
 
(4 dazwischenliegende Versionen desselben Benutzers werden nicht angezeigt)
Zeile 8: Zeile 8:
 
   "variables": {
 
   "variables": {
 
     "username": "root@pam",
 
     "username": "root@pam",
     "password": "123Stop-Xinux"
+
     "password": "Streng-Geheim"
 
   },
 
   },
 
   "builders": [
 
   "builders": [
Zeile 73: Zeile 73:
  
 
==Bild Vorgang starten==
 
==Bild Vorgang starten==
*packer build debian11-qemu.json
+
*packer build debian11-proxmox.json
 
<pre>
 
<pre>
qemu output will be in this color.
+
proxmox: output will be in this color.
  
==> qemu: Retrieving ISO
+
==> proxmox: Creating VM
    qemu: Found already downloaded, initial checksum matched, no download needed: http://daisy.xinux.org/isos/debian-11.3.0-amd64-netinst.iso
+
==> proxmox: No VM ID given, getting next free from Proxmox
==> qemu: Creating hard drive...
+
==> proxmox: Starting VM
==> qemu: Starting HTTP server on port 8603
+
==> proxmox: Starting HTTP server on port 8306
==> qemu: Found port for communicator (SSH, WinRM, etc): 2970.
+
==> proxmox: Waiting 10s for boot
==> qemu: Looking for available port between 5900 and 6000 on 127.0.0.1
+
==> proxmox: Typing the boot command
==> qemu: Starting VM, booting from CD-ROM
+
==> proxmox: Waiting for SSH to become available...
==> qemu: Overriding defaults Qemu arguments with QemuArgs...
+
==> proxmox: Stopping VM
==> qemu: Waiting 10s for boot...
+
==> proxmox: Converting VM to template
==> qemu: Connecting to VM via VNC (127.0.0.1:5903)
+
Build 'proxmox' finished after 8 minutes 16 seconds.
==> qemu: Typing the boot command over VNC...
+
 
</pre>
+
==> Wait completed after 8 minutes 16 seconds
[[Datei:Packer-1.png]]
 
==Abschluss der Installation==
 
<pre>
 
==> 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:
 
==> Builds finished. The artifacts of successful builds are:
--> qemu: VM files in directory: output-qemu
+
--> proxmox: A template was created: 7035
 
</pre>
 
</pre>
 +
 
==Ergebnis==
 
==Ergebnis==
*file output-qemu/packer-qemu
+
Als Ergebnis haben wir ein Template
output-qemu/packer-qemu: QEMU QCOW2 Image (v3), 5242880000 bytes
+
[[Datei:Packer-2.png]]

Aktuelle Version vom 5. April 2022, 13:44 Uhr

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...
==> proxmox: Stopping VM
==> proxmox: Converting VM to template
Build 'proxmox' finished after 8 minutes 16 seconds.

==> Wait completed after 8 minutes 16 seconds

==> Builds finished. The artifacts of successful builds are:
--> proxmox: A template was created: 7035

Ergebnis

Als Ergebnis haben wir ein Template Packer-2.png