2021-08-30 11:31:56 -04:00
|
|
|
# Mirror Env
|
2021-09-26 00:46:38 -04:00
|
|
|
This repo helps quickly set up a vm development environment for cs club's
|
|
|
|
mirrors using ansible.
|
2021-09-02 15:47:07 -04:00
|
|
|
|
2021-09-26 00:46:38 -04:00
|
|
|
There are three options for getting the mirror dev vm running:
|
|
|
|
- qemu
|
|
|
|
- libvirt
|
|
|
|
- manual
|
|
|
|
|
|
|
|
Follow the relevant instructions below.
|
2021-09-12 18:33:30 -04:00
|
|
|
|
2021-09-26 00:46:38 -04:00
|
|
|
## VM Installation Option 1 (qmeu)
|
2021-09-12 18:33:30 -04:00
|
|
|
|
2021-09-26 00:46:38 -04:00
|
|
|
Install the following:
|
|
|
|
- ansible
|
2021-09-02 15:47:07 -04:00
|
|
|
- qemu
|
|
|
|
- genisoimage
|
|
|
|
- ovmf (find the location of OVMF\_CODE.fd, it is system dependent)
|
|
|
|
|
2021-09-26 00:46:38 -04:00
|
|
|
Before doing anything else, edit the config files in `group_vars/` to your
|
|
|
|
system's needs. For qemu installation specifically, you need to provide the
|
|
|
|
location of your `OVMF_CODE.fd` file.
|
2021-09-02 15:47:07 -04:00
|
|
|
|
2021-09-26 00:46:38 -04:00
|
|
|
To begin the setup process, in this repo's root, run:
|
2021-08-31 22:48:50 -04:00
|
|
|
```
|
2021-09-26 00:46:38 -04:00
|
|
|
$ ansible-playbook -K qemu/main.yml
|
2021-08-31 22:48:50 -04:00
|
|
|
```
|
2021-09-02 15:47:07 -04:00
|
|
|
|
2021-09-26 00:46:38 -04:00
|
|
|
Due to the way the ubuntu autoinstall is designed, user confirmation is
|
|
|
|
required to start the autoinstallation process. To view the vm, you also need a
|
|
|
|
vnc viewer. [TigerVNC](https://github.com/TigerVNC/tigervnc) is a good choice.
|
|
|
|
|
|
|
|
Simply run
|
2021-09-02 15:47:07 -04:00
|
|
|
```
|
|
|
|
$ vncviewer :5900
|
|
|
|
```
|
|
|
|
|
2021-09-26 00:46:38 -04:00
|
|
|
Enter `yes` when prompted with
|
|
|
|
this line:
|
2021-09-02 15:47:07 -04:00
|
|
|
```
|
|
|
|
Continue with autoinstall (yes|no)
|
|
|
|
```
|
|
|
|
|
2021-09-26 00:46:38 -04:00
|
|
|
Once the installation is complete, you can run the vm using:
|
2021-09-02 15:47:07 -04:00
|
|
|
```
|
2021-09-26 00:46:38 -04:00
|
|
|
$ ansible-playbook qemu/run/yml
|
2021-09-02 15:47:07 -04:00
|
|
|
```
|
|
|
|
|
|
|
|
The default login user has
|
|
|
|
```
|
|
|
|
username: ubuntu
|
|
|
|
password: ubuntu
|
|
|
|
```
|
2021-09-12 13:14:40 -04:00
|
|
|
|
2021-09-26 00:46:38 -04:00
|
|
|
## VM Install Option 2 (libvirt)
|
2021-09-12 13:14:40 -04:00
|
|
|
|
|
|
|
### Install Packages (debian)
|
2021-09-17 16:42:15 -04:00
|
|
|
**needs update**
|
2021-09-12 13:14:40 -04:00
|
|
|
```
|
2021-09-17 01:02:45 -04:00
|
|
|
$ apt install qemu-kvm libvirt-daemon virt-manager virt-viewer ansible cloud-image-utils
|
|
|
|
qemu-kvm libvirt-clients libvirt-daemon-system bridge-utils virtinst libvirt-daemon virt-manager
|
2021-09-12 13:14:40 -04:00
|
|
|
```
|
|
|
|
|
|
|
|
### Install Packages (archlinux)
|
2021-09-17 16:42:15 -04:00
|
|
|
**needs update**
|
2021-09-12 13:14:40 -04:00
|
|
|
```
|
2021-09-17 01:02:45 -04:00
|
|
|
$ pacman -S qemu libvirt virt-install virt-viewer ansible
|
2021-09-12 13:14:40 -04:00
|
|
|
```
|
|
|
|
|
|
|
|
### Run Playbook
|
|
|
|
```
|
2021-09-17 01:02:45 -04:00
|
|
|
ansible-playbook libvirt/main.yml
|
2021-09-12 13:14:40 -04:00
|
|
|
```
|
2021-09-02 15:47:07 -04:00
|
|
|
|
2021-09-11 23:56:31 -04:00
|
|
|
First, install ansible and sshpass. Perform all the following commands in the `post-install/` directory.
|
|
|
|
|
2021-09-12 18:57:51 -04:00
|
|
|
Also install the extra roles
|
|
|
|
```
|
|
|
|
$ ansible-galaxy install -r requirements.yml
|
|
|
|
```
|
2021-09-11 23:56:31 -04:00
|
|
|
Check that ansible can talk to the vm:
|
|
|
|
```
|
|
|
|
$ ansible -m ping all
|
|
|
|
```
|
|
|
|
|
|
|
|
We can now complete the rest of the post-install with
|
|
|
|
```
|
|
|
|
$ ansible-playbook -K playbook.yml
|
|
|
|
```
|
2021-09-02 15:47:07 -04:00
|
|
|
|
2021-09-26 00:46:38 -04:00
|
|
|
## VM Install Option 3 (manual)
|
|
|
|
|
2021-09-02 15:47:07 -04:00
|
|
|
## System Details
|
2021-09-26 00:46:38 -04:00
|
|
|
Further system information for those that are interested.
|
|
|
|
|
2021-09-02 15:47:07 -04:00
|
|
|
```
|
2021-09-12 13:14:40 -04:00
|
|
|
$ lsblk
|
2021-09-02 15:47:07 -04:00
|
|
|
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
|
|
|
|
vda 252:0 0 10G 0 disk
|
|
|
|
├─vda1 252:1 0 500M 0 part /boot/efi
|
|
|
|
└─vda2 252:2 0 9G 0 part
|
|
|
|
└─md0 9:0 0 9G 0 raid1
|
|
|
|
└─vg0-root 253:0 0 8G 0 lvm /
|
|
|
|
vdb 252:16 0 10G 0 disk
|
|
|
|
├─vdb1 252:17 0 500M 0 part
|
|
|
|
└─vdb2 252:18 0 9G 0 part
|
|
|
|
└─md0 9:0 0 9G 0 raid1
|
|
|
|
└─vg0-root 253:0 0 8G 0 lvm /
|
|
|
|
vdc 252:32 0 10G 0 disk
|
|
|
|
├─vdc1 252:33 0 10G 0 part
|
|
|
|
└─vdc9 252:41 0 8M 0 part
|
|
|
|
vdd 252:48 0 10G 0 disk
|
|
|
|
├─vdd1 252:49 0 10G 0 part
|
|
|
|
└─vdd9 252:57 0 8M 0 part
|
|
|
|
vde 252:64 0 10G 0 disk
|
|
|
|
├─vde1 252:65 0 10G 0 part
|
|
|
|
└─vde9 252:73 0 8M 0 part
|
|
|
|
vdf 252:80 0 10G 0 disk
|
|
|
|
├─vdf1 252:81 0 10G 0 part
|
|
|
|
└─vdf9 252:89 0 8M 0 part
|
|
|
|
```
|
|
|
|
Drives vda and vdb are for the main filesystem, they use raid1. Drives vdc, vdd, vde and vdf are in a raidz2 zpool.
|