First I installed Xubuntu in a virtual environment to serve as my testing ground. Then I proceeded to update the system and install Salt using the following commands:
sudo apt-get update
sudo apt-get install -y salt-master salt-minion
After this I edited the minion-file at /etc/salt/minion and added the ip-address for the master and an id.
I restarted the service and accepted the keys.
Next I ran some commands to see if my new set up was working.
sudo salt ‘*’ test.ping (pictured)
sudo salta ‘*’ cmd.run ‘whoami’
After this I wrote up some states. First one I did was a basic ‘Hello World’ test to see if I could even get any states working.
When this test worked as planned I moved onto modifying the lamp.sls state from Joona Leppälahti’s Salt project. I only used the first function to see if it worked.
After this I wrote my own state to verify that I had understood the basic principles correctly.
This yielded a successful result, like the previous two tests.
Using salt-grains to get statistics
Using the command: sudo salt ‘*’ grains.items I got a list of statistics from my computer.
Using sudo salt ‘*’ grains.items|less I got a more condensed version of it.
As my computer is a virtual machine in this case, a lot of the data is unknown or replaced by VirtualBox.