Vagrant & simple shell script (h4)

a)
In this exercise I’m going to write a simple shell script, that will make my machine a salt slave.
I dont have experience in shell scripting but since this script is quite simple I decided to give it a try:
#!/bin/bash
sudo apt install salt-minion
sudo nano /etc/salt/minion: “master: 192.168.190.128”
sudo systemctl restart salt-minion

This didn’t work. It just opened the file /etc/salt/minion but didn’t type in my masters ip. So I decided to look it up from the internet, and found article in stackoverflow which helped me to get forward.

I had to use “echo” instead of nano.
After running the shell script on slave, the key appeared on my master waiting to be accepted. My master in this case is Xubuntu running on VMware on my host Windows 10.

I thought it would be good idea to put the script on git so I could easily access it on a computer I want to make as a slave.
First I cloned my git srv repo to my slave: git clone https://github.com/arttugit/srv.git
Then added the script to git: git add testscript.sh
And finally making a commit: git add . git commit; git push; git pull

c)
Now it is time to install and try vagrant. My few first tries installing vagrant wasn’t so successful. I begun installing vagrant and virtualbox. After both packages were installed I headed to vagrant website to look for boxes. At this time I was trying to install vagrant on my guest machine xubuntu. I picked the most downloaded one, ubuntu server 14.04 LTS and entered following commands:

Everything seemed to work, until it stuck there and after five minutes it timed out.
I tried installing it again, but no luck. I even tried it with other guest machine.

After investigating this issue and finding information about it on the web, I found one post that suggested enabling the GUI so I could see an error message. So I enabled the GUI by editing the Vagrantfile.

After enabling the GUI this error message displayed. Then I realized it may be a little complicated to run virtualization within a virtualization.
Then I booted xubuntu live and did the exact same steps I did before inside virtualmachine. It seemed to be working.
After succesfully starting the VM, I was able to SSH in to it.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s