moved back to group_vars

autoautoinstall
Daniel Liu 1 year ago
parent 1f966eedd0
commit 5cee6914d5
  1. 51
      README.md
  2. 6
      group_vars/all.yml
  3. 59
      mirror-vm
  4. 6
      qemu/main.yml

@ -1,37 +1,49 @@
# Mirror Env
This script helps quickly set up a vm development environment for cs club's mirrors.
This repo helps quickly set up a vm development environment for cs club's
mirrors using ansible.
## VM Installation Option 1 (qmeu-vm.yml)
There are three options for getting the mirror dev vm running:
- qemu
- libvirt
- manual
Follow the relevant instructions below.
**instructions need to be rewritten**
## VM Installation Option 1 (qmeu)
Install the following dependencies
Install the following:
- ansible
- qemu
- genisoimage
- ovmf (find the location of OVMF\_CODE.fd, it is system dependent)
Edit the configuration variables in the script file to reflect your system.
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.
The `mirror-vm` script will will automatically install ubuntu using the [autoinstall](https://ubuntu.com/server/docs/install/autoinstall) feature.
To begin the setup process, in this repo's root, run:
```
curl -O https://releases.ubuntu.com/20.04/ubuntu-20.04.2-live-server-amd64.iso
$ ./mirror-vm create
$ ./mirror-vm run-install
$ ansible-playbook -K qemu/main.yml
```
To view the vm, you also need a vnc viewer. [TigerVNC](https://github.com/TigerVNC/tigervnc) is a good choice. Simply run
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
```
$ vncviewer :5900
```
Due to the way the ubuntu autoinstall is designed, user confirmation is required to start the autoinstallation process. Enter `yes` when prompted with this line:
Enter `yes` when prompted with
this line:
```
Continue with autoinstall (yes|no)
```
After going through the install process you can run the vm with
Once the installation is complete, you can run the vm using:
```
$ ./mirror-vm run
$ ansible-playbook qemu/run/yml
```
The default login user has
@ -39,12 +51,8 @@ The default login user has
username: ubuntu
password: ubuntu
```
### Run Playbook
```
ansible-playbook qemu-vm.yml
```
## VM Install Option 2 (kvm)
## VM Install Option 2 (libvirt)
### Install Packages (debian)
**needs update**
@ -64,9 +72,6 @@ $ pacman -S qemu libvirt virt-install virt-viewer ansible
ansible-playbook libvirt/main.yml
```
## Post-Installation
The ubunutu autoinstall can only handle basic installation. We require a more powerful tool to configure the post-install environment. For this reason, we will be using ansible.
First, install ansible and sshpass. Perform all the following commands in the `post-install/` directory.
Also install the extra roles
@ -83,7 +88,11 @@ We can now complete the rest of the post-install with
$ ansible-playbook -K playbook.yml
```
## VM Install Option 3 (manual)
## System Details
Further system information for those that are interested.
```
$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT

@ -0,0 +1,6 @@
---
ovmf:
vm_ram: 1G
vm_disk_size: 9G
vm_ssh_port: 22
userdata: "{{playbook_dir}}/userdata"

@ -1,59 +0,0 @@
#!/bin/sh
help() {
cat << EOF
=-=-=-=-= mirror-vm =-=-=-=-=
Usage: mirror-vm [COMMAND]
Commands:
libvirt-install, li
creates and installs the mirror server
on a new vm using libvirt
qemu-install, qi
creates and installs the mirror server
on a new vm using qemu
libvirt-run, lr
runs a previously created libvirt vm
qemu-run, qr
runs a previously created qemu vm
clean, c
removes user files like your vm
help, h
prints this message
EOF
}
libvirt_install() {
ansible-playbook -K libvirt/main.yml
}
qemu_install() {
ansible-playbook -K qemu/main.yml
}
libvirt_run() {
echo 'libvirt-run'
}
qemu_run() {
ansible-playbook -K qemu/run.yml
}
clean() {
rm -rf qemu/vm libvirt/vm
}
case $1 in
li|libvirt-install) libvirt_install;;
qi|qemu-install) qemu_install;;
lr|libvirt-run) libvirt_run;;
qr|qemu-run) qemu_run;;
c|clean) clean;;
h|help|*) help;;
esac

@ -1,12 +1,6 @@
---
# Gather info
- hosts: localhost
vars:
ovmf:
vm_ram: 1G
vm_disk_size: 9G
vm_ssh_port: 22
userdata: "{{playbook_dir}}/userdata"
tasks:
- name: Check if vm was created already
stat:

Loading…
Cancel
Save