mirror of
https://github.com/Noratrieb/vmlab.git
synced 2026-01-16 09:35:09 +01:00
try things
This commit is contained in:
parent
9e5ec91834
commit
f6c4997f01
4 changed files with 33 additions and 0 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -1 +1,3 @@
|
||||||
/debian-image/build
|
/debian-image/build
|
||||||
|
/tmp
|
||||||
|
/vm-state
|
||||||
|
|
|
||||||
26
create-vms.sh
Normal file
26
create-vms.sh
Normal file
|
|
@ -0,0 +1,26 @@
|
||||||
|
#!/usr/bin/bash
|
||||||
|
|
||||||
|
set -eu
|
||||||
|
|
||||||
|
NAME="$1"
|
||||||
|
|
||||||
|
mkdir -p tmp
|
||||||
|
mkdir -p vm-state
|
||||||
|
|
||||||
|
IMG=debian-12-genericcloud-amd64.qcow2
|
||||||
|
|
||||||
|
if ! [ -f "tmp/$IMG" ]; then
|
||||||
|
curl -L -o "tmp/$IMG" https://cloud.debian.org/images/cloud/bookworm/latest/debian-12-genericcloud-amd64.qcow2
|
||||||
|
fi
|
||||||
|
|
||||||
|
DISK="vm-state/$NAME.qcow2"
|
||||||
|
cp "tmp/$IMG" "$DISK"
|
||||||
|
|
||||||
|
virt-install -n "$NAME" \
|
||||||
|
--os-variant=debian12 \
|
||||||
|
--ram=2048 --vcpus=2 \
|
||||||
|
--import --disk "path=$DISK,bus=virtio" \
|
||||||
|
--network network=default,model=virtio \
|
||||||
|
--graphics=none --rng /dev/urandom \
|
||||||
|
--cloud-init=user-data=user-data
|
||||||
|
#--noautoconsole
|
||||||
3
init-vm.sh
Normal file
3
init-vm.sh
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
ssh-keygen -A
|
||||||
2
user-data
Normal file
2
user-data
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
ssh_authorized_keys:
|
||||||
|
- ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIG0n1ikUG9rYqobh7WpAyXrqZqxQoQ2zNJrFPj12gTpP nilsh@PC-Nils
|
||||||
Loading…
Add table
Add a link
Reference in a new issue