This assignment was completed in full from my personal desktop, with a live-USB running Xubuntu 18.04.1 and a virtual machine running Ubuntu 18.04.1
A script to turn your computer into a salt minion (19.11 – 12:10)
I created a simple bash-script to: * update package-repository * install salt-minion * edit the minion config file * restart salt-minon.service
This is what my “minionize.sh” script looks like
#!/bin/sh sudo apt-get update sudo apt-get install salt-minion -y echo "master: 22.214.171.124" | sudo tee /etc/salt/minion sudo systemctl restart salt-minion.service
Installing and testing Vagrant (12:36)
I started by installing Vagrant and virtualbox
sudo apt-get install virtualbox vagrant -y
Next i had to decide which OS i want to run in my Vagrant box.
To create a Vagrant box with said image:
sudo vagrant init hashicorp/precise64 sudo vagrant up
Running these commands did not work at first, and i was greeted with an error:
VT-x is disabled in the BIOS for both all CPU modes (VERR_VMX_MSR_ALL_VMX_DISABLED)
Luckily the error was pretty descriptive: something called VT-x has to be enabled in my BIOS for virtualization to work. A quick trip to Stackoverflow confirmed that VT-x stands for Intel Virtualization technology
For my Asus z370-P motherboard it was located under Advanced > CPU > Intel Virtualization technology.
This worked, and running the commands again succesfully deployed a vagrant virtualbox. To log into my newly created virutal OS:
sudo vagrant ssh
Multiple different Vagrant instances (13:48)
I wanted to try running multiple different Vagrant-boxes with different operating-systems side by side.
I first made the folders for my new instance:
I did this because deploying Vagrant creates a config file to your current directory, and therefore you need different locatons for different instances.
Setting up the additional Vagrant-instances
The way to set these boxes up is identical to the one we already did, so i won’t go into great detail about it.
I decided to scroll a bit further down on the vagrant image-list to see if i could find something more exotic that just a regular OS.
Scotch box is a is “Just a dead-simple local LAMP stack for developers that just works.”
I navigated to my vagrant_2 folder and issued commands:
sudo vagrant init scotch/box sudo vagrant up
I then made this virtual machine a minion using the script i made earlier to quickly configure the already installed LAMP stack on this machine using salt.
Scotchbox$ bash minionize.sh
master$ sudo salt-key -A The following keys are going to be accepted: Unaccepted Keys: vagrant.vm Proceed? [n/Y] Y Key for minion vagrant.vm accepted. master$ sudo salt "vagrant.vm" state.highstate
The salt state i executed can be found here
Everything else worked, but for some reason salt was unable to restart the services, and could not create the public_html directory. I did these manually.
Things i will try out later/didn’t feel like solving right now
- You can configure the Vagrantfile to host multiple VMs in a single directory. However if there’s no practical need to do so, i find it easier to just host them in separate directories.
- You can start different VMs by CDing to their respective directories and issuing
vagrant sshYou can use an ID if there are many VMs configured in a single directory.
- I have no idea how to access VMs localhost. (Port forwarding needed?)