Compare commits
3 Commits
b5484631e2
...
0629eadf85
| Author | SHA1 | Date | |
|---|---|---|---|
| 0629eadf85 | |||
| 5ecc21bb9d | |||
| bffb3b2853 |
@@ -1,8 +1,5 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
# Debian 13 VM – Version FR personnalisée
|
|
||||||
# Basé sur community-scripts + adaptations
|
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
VMID=$(pvesh get /cluster/nextid)
|
VMID=$(pvesh get /cluster/nextid)
|
||||||
@@ -10,7 +7,7 @@ HN="debian13"
|
|||||||
BRG="dhcp"
|
BRG="dhcp"
|
||||||
CORE_COUNT="2"
|
CORE_COUNT="2"
|
||||||
RAM_SIZE="2048"
|
RAM_SIZE="2048"
|
||||||
DISK_SIZE="8G"
|
DISK_SIZE="40G"
|
||||||
|
|
||||||
echo "Création VM Debian 13 ID: $VMID"
|
echo "Création VM Debian 13 ID: $VMID"
|
||||||
|
|
||||||
@@ -25,7 +22,6 @@ curl -fLO "$URL"
|
|||||||
|
|
||||||
STORAGE="local-zfs"
|
STORAGE="local-zfs"
|
||||||
|
|
||||||
echo "Création VM..."
|
|
||||||
qm create $VMID \
|
qm create $VMID \
|
||||||
-name "$HN" \
|
-name "$HN" \
|
||||||
-memory $RAM_SIZE \
|
-memory $RAM_SIZE \
|
||||||
@@ -44,16 +40,41 @@ qm set $VMID \
|
|||||||
-serial0 socket \
|
-serial0 socket \
|
||||||
-scsi1 ${STORAGE}:cloudinit
|
-scsi1 ${STORAGE}:cloudinit
|
||||||
|
|
||||||
# DHCP IPv4 cloud-init
|
|
||||||
qm set $VMID --ipconfig0 ip=dhcp
|
|
||||||
|
|
||||||
# ===== Clavier + Locale FR =====
|
# DHCP IPv4 dans l'UI cloud-init
|
||||||
|
qm set "$VMID" --ipconfig0 ip=dhcp >/dev/null
|
||||||
|
|
||||||
|
# Root user + password via Proxmox cloud-init (fiable)
|
||||||
|
qm set "$VMID" --ciuser root --cipassword "root" >/dev/null
|
||||||
|
|
||||||
|
# Meilleure résolution console
|
||||||
|
qm set "$VMID" --vga virtio >/dev/null
|
||||||
|
|
||||||
|
# Resize disque côté Proxmox
|
||||||
|
qm resize "$VMID" scsi0 "$DISK_SIZE" >/dev/null
|
||||||
|
|
||||||
|
# ===== Cloud-init FR + ROOT PASSWORD + PROXMOX AGENT =====
|
||||||
|
|
||||||
SNIPPET_DIR="/var/lib/vz/snippets"
|
SNIPPET_DIR="/var/lib/vz/snippets"
|
||||||
mkdir -p "$SNIPPET_DIR"
|
mkdir -p "$SNIPPET_DIR"
|
||||||
|
|
||||||
cat > "$SNIPPET_DIR/${VMID}-user-data.yaml" <<EOF
|
cat > "$SNIPPET_DIR/${VMID}-user-data.yaml" <<EOF
|
||||||
#cloud-config
|
#cloud-config
|
||||||
|
|
||||||
|
disable_root: false
|
||||||
|
ssh_pwauth: true
|
||||||
|
|
||||||
|
growpart:
|
||||||
|
mode: auto
|
||||||
|
devices: ["/"]
|
||||||
|
ignore_growroot_disabled: false
|
||||||
|
resize_rootfs: true
|
||||||
|
|
||||||
|
chpasswd:
|
||||||
|
list: |
|
||||||
|
root:root
|
||||||
|
expire: false
|
||||||
|
|
||||||
locale: fr_FR.UTF-8
|
locale: fr_FR.UTF-8
|
||||||
|
|
||||||
packages:
|
packages:
|
||||||
@@ -61,6 +82,7 @@ packages:
|
|||||||
- kbd
|
- kbd
|
||||||
- console-setup
|
- console-setup
|
||||||
- keyboard-configuration
|
- keyboard-configuration
|
||||||
|
- qemu-guest-agent
|
||||||
|
|
||||||
write_files:
|
write_files:
|
||||||
- path: /etc/default/keyboard
|
- path: /etc/default/keyboard
|
||||||
@@ -72,15 +94,22 @@ write_files:
|
|||||||
KEYMAP="fr"
|
KEYMAP="fr"
|
||||||
|
|
||||||
runcmd:
|
runcmd:
|
||||||
|
# Locale FR
|
||||||
- sed -i 's/^# fr_FR.UTF-8 UTF-8/fr_FR.UTF-8 UTF-8/' /etc/locale.gen
|
- sed -i 's/^# fr_FR.UTF-8 UTF-8/fr_FR.UTF-8 UTF-8/' /etc/locale.gen
|
||||||
- locale-gen
|
- locale-gen
|
||||||
- update-locale LANG=fr_FR.UTF-8
|
- update-locale LANG=fr_FR.UTF-8
|
||||||
|
|
||||||
|
# Clavier console FR
|
||||||
- loadkeys fr || true
|
- loadkeys fr || true
|
||||||
- setupcon -k || true
|
- setupcon -k || true
|
||||||
|
|
||||||
|
# Activation agent Proxmox
|
||||||
|
- systemctl enable qemu-guest-agent
|
||||||
|
- systemctl start qemu-guest-agent
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
qm set $VMID --cicustom "user=local:snippets/${VMID}-user-data.yaml"
|
qm set $VMID --cicustom "user=local:snippets/${VMID}-user-data.yaml"
|
||||||
|
|
||||||
echo "VM Debian 13 créée avec succès : $VMID"
|
echo "VM Debian 13 créée avec succès : $VMID"
|
||||||
echo "Bridge : dhcp | DHCP IPv4 activé | FR OK"
|
echo "Bridge : dhcp | DHCP IPv4 | Clavier FR | root/root | Agent Proxmox OK"
|
||||||
echo "La VM n'est PAS démarrée automatiquement."
|
echo "La VM n'est PAS démarrée automatiquement."
|
||||||
Reference in New Issue
Block a user