This commit is contained in:
Andrew Wang 2021-10-03 21:55:32 -04:00
commit 0f4ff082db
7 changed files with 82 additions and 52 deletions

View File

@ -3,54 +3,13 @@ This repo helps quickly set up a vm development environment for cs club's
mirrors using ansible. mirrors using ansible.
There are three options for getting the mirror dev vm running: There are three options for getting the mirror dev vm running:
- qemu - qemu (automated install)
- libvirt - libvirt (manual install)
- manual
Follow the relevant instructions below. Follow the relevant instructions below.
## VM Installation Option 1 (qmeu) ## VM Installation Option 1 (qmeu)
Follow instructions in the README.md of the qemu directory
Install the following:
- ansible
- qemu
- genisoimage
- ovmf (find the location of OVMF\_CODE.fd, it is system dependent)
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.
To begin the setup process, in this repo's root, run:
```
$ ansible-playbook -K qemu/main.yml
```
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
```
Enter `yes` when prompted with
this line:
```
Continue with autoinstall (yes|no)
```
Once the installation is complete, you can run the vm using:
```
$ ansible-playbook qemu/run.yml
```
The default login user has
```
username: ubuntu
password: ubuntu
```
## VM Install Option 2 (libvirt) ## VM Install Option 2 (libvirt)
Follow the instructions in `libvirt/README.md` Follow the instructions in `libvirt/README.md`

23
hosts
View File

@ -1,10 +1,21 @@
# I will move this to the hosts.yml soon [local]
127.0.0.1
[local:vars]
ansible_connection=local
[vm] [vm]
192.168.123.2 host=mirror ansible_connection=ssh ansible_port=22 ansible_user=ubuntu ansible_password=ubuntu ansible_become_user=root ansible_become_password=ubuntu ubuntu@localhost
[vm:vars]
host=mirror
ansible_connection=ssh
ansible_port=7777
ansible_user=ubuntu
ansible_password=ubuntu
ansible_become_user=root
ansible_become_password=ubuntu
# 192.168.123.2 host=mirror ansible_connection=ssh ansible_port=22 ansible_user=ubuntu ansible_password=ubuntu ansible_become_user=root ansible_become_password=ubuntu
# ansible_ssh_private_key_file # ansible_ssh_private_key_file
# guide on how to create vm manually (more control, more disks)
# another playbook that runs on such a vm and sets up all the services in roles (except zfs)
[local]
127.0.0.1 ansible_connection=local

50
qemu/README.md Normal file
View File

@ -0,0 +1,50 @@
# Installation
Install the following:
- ansible
- qemu
- genisoimage
- ovmf (find the location of `OVMF\_CODE.fd`, it is system dependent)
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.
To begin the setup process, in this repo's root, run:
```
$ 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
```
$ vncviewer :5900
```
Currently, this is a bug with the installation process that causes the vm to
not terminate after completing the base install, causing the ansible task to
hang. You can manually terminate ansible once the vm shows:
![installation complete](images/installation_complete.png)
Once the base installation is complete, we need to configure the system in a
postinstall step, start by running the vm with:
```
$ ansible-playbook qemu/run.yml
```
And then run the postinstall playbook:
```
$ ansible-playbook qemu/postinstall.yml
```
The mirror dev environment is now ready to use.
The default login user has
```
username: ubuntu
password: ubuntu
```

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 KiB

View File

@ -77,4 +77,4 @@
-initrd {{userdata}}/initrd \ -initrd {{userdata}}/initrd \
-append autoinstall" -append autoinstall"
# bug: autoinstall will not shutdown properly so the ansible task will never finish # bug: autoinstall will not shutdown properly so the ansible task will never finish

10
qemu/postinstall.yml Normal file
View File

@ -0,0 +1,10 @@
---
- hosts: vm
tasks:
- name: Basic system configuration
import_role:
name: ../roles/system
# - name: Setting up ssh
# import_role:
# name: ../roles/ssh

View File

@ -53,4 +53,4 @@
systemd: systemd:
name: nginx name: nginx
state: restarted state: restarted
enabled: yes enabled: yes