init commit

This commit is contained in:
Daniel Liu 2021-08-30 11:31:56 -04:00
commit 197e1186b6
4 changed files with 114 additions and 0 deletions

1
README.md Normal file
View File

@ -0,0 +1 @@
# Mirror Env

2
meta-data Normal file
View File

@ -0,0 +1,2 @@
instance-id: mirror-dev
local-hostname: mirror-dev

52
mirror-vm Executable file
View File

@ -0,0 +1,52 @@
#!/usr/bin/make -sf
# script for managing the vm for the csc mirror dev environment
# dependencies =-=-=-=-=-=-=-=
# qemu, qenisoimage, ovmf (find the location of OVMF_CODE.fd on your system)
# user config variables =-=-=
disk_size=10G
vm_mem=2G
ovmf_location=/usr/share/edk2-ovmf/x64/OVMF_CODE.fd
install_iso=./ubuntu-20.04.2-live-server-amd64.iso
.PHONY: help create purge run-install run
help:
echo help|create|purge|run-install|run
.ONESHELL:
create:
for i in {1..6}; do
qemu-img create -f qcow2 drive$$i ${disk_size}; done
genisoimage -output seed.iso -volid cidata -joliet -rock user-data meta-data
purge:
rm drive* seed.iso
run-install:
qemu-system-x86_64 -cdrom ${install_iso} -enable-kvm -boot order=d \
-drive file=drive1,if=virtio,id=a,media=disk,format=qcow2 \
-drive file=drive2,if=virtio,id=b,media=disk,format=qcow2 \
-drive file=drive3,if=virtio,id=c,media=disk,format=qcow2 \
-drive file=drive4,if=virtio,id=d,media=disk,format=qcow2 \
-drive file=drive5,if=virtio,id=e,media=disk,format=qcow2 \
-drive file=drive6,if=virtio,id=f,media=disk,format=qcow2 \
-drive file=seed.iso,if=virtio,format=raw \
-bios ${ovmf_location} \
-m ${vm_mem}
run:
qemu-system-x86_64 -enable-kvm -boot order=d \
-drive file=drive1,if=virtio,id=a,media=disk,format=qcow2 \
-drive file=drive2,if=virtio,id=b,media=disk,format=qcow2 \
-drive file=drive3,if=virtio,id=c,media=disk,format=qcow2 \
-drive file=drive4,if=virtio,id=d,media=disk,format=qcow2 \
-drive file=drive5,if=virtio,id=e,media=disk,format=qcow2 \
-drive file=drive6,if=virtio,id=f,media=disk,format=qcow2 \
-bios ${ovmf_location} \
-m ${vm_mem} \
-net user,hostfwd=tcp::7777-:22 \
-net nic

59
user-data Normal file
View File

@ -0,0 +1,59 @@
#cloud-config
autoinstall:
version: 1
identity:
hostname: mirror
username: ubuntu
# password is just ubuntu
password: "$6$exDY1mhS4KUYCE/2$zmn9ToZwTKLhCw.b4/b.ZRTIZM30JZ4QrOQ2aOXJ8yk96xpcCof0kxKwuX1kqLG/ygbJ1f8wxED22bTL4F46P0"
locale: en_US
ssh:
allow-pw: true
authorized-keys: []
install-server: true
storage:
config:
# disks =-=-=-=-=-=-=
- {id: vda, name: '', path: /dev/vda, type: disk, ptable: gpt,
preserve: false, grub_device: false}
- {id: vdb, name: '', path: /dev/vdb, type: disk, ptable: gpt,
preserve: false, grub_device: false}
# partitions =-=-=-=-=-=
# vda1
- {id: vda1, type: partition, size: 500M, device: vda, number: 1,
preserve: false, wipe: superblock, flag: boot, grub_device: true}
- {id: vda1-format, type: format, volume: vda1,
fstype: fat32, preserve: false}
# vda2
- {id: vda2, type: partition, size: 9G, device: vda, number: 2,
preserve: false, wipe: superblock, flag: '', grub_device: false}
# vdb1
- {id: vdb1, type: partition, size: 500M, device: vdb, number: 1,
preserve: false, wipe: superblock, flag: boot, grub_device: true}
- {id: vdb1-format, type: format, volume: vdb1,
fstype: fat32, preserve: false}
# vdb2
- {id: vdb2, type: partition, size: 9G, device: vdb, number: 2,
preserve: false, wipe: superblock, flag: '', grub_device: false}
# raid =-=-=-=-=-=
- id: md0
name: md0
type: raid
raidlevel: raid1
devices: [vda2, vdb2]
spare_devices: []
preserve: false
# lvm =-=-=-=-=-=
- id: vg0
name: vg0
type: lvm_volgroup
devices: [md0]
preserve: false
# partition
- {id: vg0-root, name: root, type: lvm_partition, size: 8G,
preserve: false, volgroup: vg0}
- {id: vg0-root-format, type: format, volume: vg0-root,
fstype: ext4, preserve: false}
# mount points =-=-=-=-=-=
- {id: boot-mount, type: mount, path: /boot/efi, device: vda1-format}
- {id: root-mount, type: mount, path: /, device: vg0-root-format}