feat: add cloud-init and virt-customize method
This commit is contained in:
parent
32bf78edbe
commit
30c76bf9c5
17 changed files with 119 additions and 0 deletions
1
cloud-init_method/.gitignore
vendored
Normal file
1
cloud-init_method/.gitignore
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
*.qcow2
|
||||
7
cloud-init_method/README.md
Normal file
7
cloud-init_method/README.md
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
# Auto setup of debian vm with cloud image + cloudinit method
|
||||
|
||||
First download cloud generic image
|
||||
|
||||
wget https://cloud.debian.org/images/cloud/bookworm/latest/debian-12-generic-amd64.qcow2
|
||||
|
||||
To run the VM
|
||||
1
cloud-init_method/cloud-init-config/.gitignore
vendored
Normal file
1
cloud-init_method/cloud-init-config/.gitignore
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
out
|
||||
2
cloud-init_method/cloud-init-config/meta-data.yaml
Normal file
2
cloud-init_method/cloud-init-config/meta-data.yaml
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
instance-id: mbessinfra/sandbox03
|
||||
local-hostname: sandbox03
|
||||
22
cloud-init_method/cloud-init-config/user-data.yaml
Normal file
22
cloud-init_method/cloud-init-config/user-data.yaml
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
#cloud-config
|
||||
hostname: jpplandhost
|
||||
groups:
|
||||
- jppland
|
||||
users:
|
||||
- default
|
||||
- calyjohn
|
||||
- name: mbess
|
||||
passwd: "$6$QQuYYEMEG0bJf7iH$mhFeXl10jSQhFO8ltMAi3CtoGLOz5tPdnEBTcp.4JzS5mnBbpANvm9s.VQFMvWq8nfzgzdDZMGr1hnZLGVd2V." #root
|
||||
sudo: ALL=(ALL) NOPASSWD:ALL
|
||||
groups: sudo
|
||||
shell: /bin/bash
|
||||
lock_passwd: false
|
||||
ssh_authorized_keys:
|
||||
- "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBeNeE0gk6mO0Bz9dDvKQrhA2Oo7x05FicCQJivxqIyi sandbox"
|
||||
|
||||
write_files:
|
||||
- encoding: gzip
|
||||
content: !!binary |
|
||||
H4sIAIDb/U8C/1NW1E/KzNMvzuBKTc7IV8hIzcnJVyjPL8pJ4QIA6N+MVxsAAAA=
|
||||
path: /usr/bin/hello
|
||||
permissions: '0755'
|
||||
0
cloud-init_method/cloud-init-config/vendor-data.yaml
Normal file
0
cloud-init_method/cloud-init-config/vendor-data.yaml
Normal file
10
cloud-init_method/generate-config.sh
Executable file
10
cloud-init_method/generate-config.sh
Executable file
|
|
@ -0,0 +1,10 @@
|
|||
#!/usr/bin/sh
|
||||
cd cloud-init-config
|
||||
rm -rf out
|
||||
mkdir -p out
|
||||
cp meta-data.yaml out/meta-data
|
||||
cp user-data.yaml out/user-data
|
||||
cd out
|
||||
genisoimage -output seed.iso -volid cidata -joliet -rock user-data meta-data
|
||||
|
||||
|
||||
12
cloud-init_method/init.sh
Executable file
12
cloud-init_method/init.sh
Executable file
|
|
@ -0,0 +1,12 @@
|
|||
#!/usr/bin/sh
|
||||
|
||||
wget -N https://cloud.debian.org/images/cloud/bookworm/latest/debian-12-generic-amd64.qcow2
|
||||
|
||||
# virt-install \
|
||||
# --name=sandbox03 \
|
||||
# --ram=512 --vcpus=1 \
|
||||
# --import --disk path=debian-12-generic-amd64.qcow2,format=qcow2 \
|
||||
# --disk path=cloud-init-config/seed.iso,device=cdrom \
|
||||
# --os-variant=debian12 \
|
||||
# --network bridge=virbr0,model=virtio
|
||||
|
||||
13
cloud-init_method/run.sh
Executable file
13
cloud-init_method/run.sh
Executable file
|
|
@ -0,0 +1,13 @@
|
|||
#!/usr/bin/sh
|
||||
|
||||
qemu-system-x86_64 \
|
||||
-machine accel=kvm \
|
||||
-cpu host \
|
||||
-m 512 \
|
||||
-nographic \
|
||||
-hda ./debian-12-generic-amd64.qcow2 \
|
||||
-drive driver=raw,file=./cloud-init-config/out/seed.iso,if=virtio \
|
||||
-net nic \
|
||||
-net user,hostfwd=tcp::2222-:22
|
||||
|
||||
#-smbios type=1,serial=ds='nocloud;s=http://10.0.2.2:8000/'
|
||||
Loading…
Add table
Add a link
Reference in a new issue