diff --git a/README.md b/README.md index cdcd21d..e0b7ebe 100644 --- a/README.md +++ b/README.md @@ -3,54 +3,13 @@ This repo helps quickly set up a vm development environment for cs club's mirrors using ansible. There are three options for getting the mirror dev vm running: -- qemu -- libvirt -- manual +- qemu (automated install) +- libvirt (manual install) Follow the relevant instructions below. ## VM Installation Option 1 (qmeu) - -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 -``` +Follow instructions in the README.md of the qemu directory ## VM Install Option 2 (libvirt) Follow the instructions in `libvirt/README.md` diff --git a/hosts b/hosts index 6562eac..75678e8 100644 --- a/hosts +++ b/hosts @@ -1,10 +1,21 @@ -# I will move this to the hosts.yml soon +[local] +127.0.0.1 + +[local:vars] +ansible_connection=local [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 -# 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 diff --git a/qemu/README.md b/qemu/README.md new file mode 100644 index 0000000..d7d95b7 --- /dev/null +++ b/qemu/README.md @@ -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 +``` + diff --git a/qemu/images/installation_complete.png b/qemu/images/installation_complete.png new file mode 100644 index 0000000..f2a93df Binary files /dev/null and b/qemu/images/installation_complete.png differ diff --git a/qemu/main.yml b/qemu/main.yml index 6449191..02608c5 100644 --- a/qemu/main.yml +++ b/qemu/main.yml @@ -77,4 +77,4 @@ -initrd {{userdata}}/initrd \ -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 diff --git a/qemu/postinstall.yml b/qemu/postinstall.yml new file mode 100644 index 0000000..d45346e --- /dev/null +++ b/qemu/postinstall.yml @@ -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 + diff --git a/roles/nginx/tasks/main.yml b/roles/nginx/tasks/main.yml index e8f721c..25a8372 100644 --- a/roles/nginx/tasks/main.yml +++ b/roles/nginx/tasks/main.yml @@ -53,4 +53,4 @@ systemd: name: nginx state: restarted - enabled: yes \ No newline at end of file + enabled: yes