Artikel: Proxmox-Hosts verwalten Listing 1: Ansible-Task für das Squid-Ceph-Repository - name: Enable Ceph-Squid repository for Proxmox VE ansible.builtin.apt_repository: repo: deb https://enterprise.proxmox.com/debian/ceph-squid bookworm enterprise state: present filename: ceph Listing 2: Proxmox-Installation per Ansible hosts: all become: True roles: - role: bodsch.chrony - role: lae.proxmox vars: pve_group: all pve_reboot_on_kernel_update: true pve_pcie_passthrough_enabled: true pve_iommu_passthrough_mode: true pve_iommu_unsafe_interrupts: false pve_mediated_devices_enabled: false pve_pcie_ovmf_enabled: false pve_pci_device_ids: - id: "10de:1381" - id: "10de:0fbc" pve_vfio_blacklist_drivers: - name: "radeon" - name: "nouveau" - name: "nvidia" pve_pcie_ignore_msrs: false pve_pcie_report_msrs: true pve_ceph_enabled: true pve_ceph_network: '172.10.0.0/24' pve_ceph_cluster_network: '172.10.1.0/24' pve_ceph_osds: - device: /dev/sdc - device: /dev/sdd pve_zfs_enabled: true pve_storages: - name: zfs1 type: zfspool content: [ "images", "rootdir" ] pool: rpool/data sparse: true Artikel: Storage einrichten und verwalten Listing 1: Merkmale eines QCOW2-Disk-Images ermitteln qemu-img info /mnt/pve/storage/images/100/vm-100-disk-0.qcow2 image: /mnt/pve/backup/images/100/vm-100-disk-0.qcow2 file format: qcow2 virtual size: 4 GiB (4294967296 bytes) disk size: 2.63 GiB cluster_size: 65536 Snapshot list: ID TAG VM_SIZE DATE VM_CLOCK ICOUNT 1 snap1 0 B 2025-04-23 09:19:03 0000:00:00.000 0 2 snap2 0 B 2025-04-23 10:03:21 0000:44:01.300 -- Format specific information: compat: 1.1 compression type: zlib lazy refcounts: false refcount bits: 16 corrupt: false extended l2: false Child node '/file': filename: /mnt/pve/backup/images/100/vm-100-disk-0.qcow2 protocol type: file file length: 2.78 GiB (2980119040 bytes) disk size: 2.63 GiB Format specific information: extent size hint: 1048576 Listing 2: Eigenschaften eines LVM-Thin-Pools lvdisplay pve/data --- Logical volume --- LV Name data VG Name pve LV UUID 1F3ucK-zGUo-wTof-LKcvo8Qf-k38V-TEJ9Fp LV Write Access read/write (activated read only) LV Creation host, time proxmox, 2024-08-06 13:10:41 +0000 LV Pool metadata data_tmeta LV Pool data data_tdata LV Status available # open 0 LV Size 11.80 GiB Allocated pool data 16.04% Allocated metadata 1.63% Current LE 3022 Segments 1 Allocation inherit Read ahead sectors auto - currently set to 256 Block device 252:6 Artikel: Backup und Restore Listing: Hookscript für Sicherung einer Datenbank-VM #!/bin/bash # Siehe Phasen in der Beispieldatei: https://git.proxmox.com/?p=pve-manager.git;a=blob; f=vzdump-hook-script.pl # Beispiel-URL für externes Monitoringsystem (anpassen für eigene Umgebung) MONITORING_URL="http://monitoring.local/api" PHASE="$1" VMID="$2" MODE="$3" STOREID="$4" DUMPDIR="$5" ARCHIVE_FILE="$6" if [[ -z $PHASE || -z $VMID || -z $MODE ]]; then echo "BAIL: not all arguments given!" exit 1 fi case "$PHASE" in backup-start) echo "Backup für Datenbank-VM $VMID gestartet" # Monitoring-System über Backupstart informieren curl -X POST "$MONITORING_URL/backup-start" -d "vm=$VMID" # Datenbank in konsistenten Zustand bringen vor dem Stoppen echo "Bereite Datenbank für Backup vor..." if ! qm guest exec $VMID --timeout 300 -- mysql -u backup -e "FLUSH TABLES WITH READ LOCK;"; then echo "FEHLER: MySQL FLUSH TABLES fehlgeschlagen" exit 1 # Exit-Code != 0 bricht das Backup ab fi ;; post-restart) # Datenbank-Locks nach Backup wieder freigeben if ! qm guest exec $VMID --timeout 300 -- mysql -u backup -e "UNLOCK TABLES;"; then echo "FEHLER: MYSQL UNLOCK fehlgeschlagen" # Das Backup hat funktioniert, daher erfolgt hier kein Abbruch ;; backup-stop) echo "Backup für VM $VMID erfolgreich - Archiv: $DUMPDIR/$ARCHIVE_FILE" # Monitoring über erfolgreichen Abschluss informieren curl -X POST "$MONITORING_URL/backup-status" -d "vm=$VMID&status=success&archive= $DUMPDIR/$ARCHIVE_FILE" ;; backup-abort) echo "FEHLER - Backup für VM $VMID fehlgeschlagen!" # Monitoring über fehlgeschlagenes Backup informieren curl -X POST "$MONITORING_URL/backup-status" -d "vm=$VMID&status=failed" ;; esac exit 0