My hardware: AMD Ryzen 7 2700X (stock clocks), RTX 2080 Ti, 250 GB Samsung EVO 950 (or 750), 1 TB generic HDD, Asus MG279Q 27″ 2560 x 1440 main screen, some old Fujitsu-Siemens 1680 x 1050 TN panel I don’t know the size of. Mouse and keyboard are “gaming” branded, though that will not matter for these assignments and homework.
I started by installing a fresh Xubuntu virtual machine. I already had an Ubuntu server running Pi-Hole, so I though to save time and just use that as my master. Let’s update the machines and install salt:
sudo apt-get install salt-master
sudo apt-get install salt-minion
The commands are simple, and the process is fast. Check both IP addresses, you want them to be easily accessible:
After googling why the pings didn’t stop (closing the terminal did not stop sending pings to master) I got back to it. Turns out I didn’t specify amount of pings, so it assumed infinite.
Next, the minion needs to know where the master is. We can specify that by doing minion$ sudoedit /etc/salt/minion and adding a few lines.
We need to restart the minion to make it visible to the master. minion$ sudo systemctl restart salt-minion. Let’s accept the minion on the master: master$ sudo salt-key -A. Run the command again to confirm it was accepted.
I mistakenly put the minion’s name as “pihole”. So be it. Running master$ sudo salt ‘*’ cmd.run ‘whoami’ will return its name; root.
I want to try to give the minion some instructions. I need to create the files to make it happen. master$ sudo mkdir -p /srv/salt/hello and master$ sudoedit /srv/salt/hello/hello.sls.
Day 2: The previous method of creating individual folders for the sls files like instructed during class, I am starting over and doing it as they are in the instructions since I ran into a wall trying to do it fancier. This is a direct continuation of the previous, but without the subdirectories.
A top.sls file has to exist. master$ sudoedit /srv/salt/top.sls. We want the following in it:
Note that this is two spaces, and then four spaces. Tabs will not work.
Let’s actually create the hello.sls file now, no fancy subdirectories: master$ sudoedit /srv/salt/hello.sls. Type the following into it.
– source: salt://hello.txt
We created the hello.sls, so let’s create the text file for it as well: master$ sudoedit /srv/salt/hello.txt. The text in the file is irrelevant, so write whatever you want in it. Let’s apply it: master$ sudo salt ‘*’ state.apply hello.
We can display the minion’s system and hardware information using the command master$ sudo salt ‘*’ grains.items.
I tested a pre-existing sls as well:
master$ sudoedit /srv/salt/test.sls where I copied a part of an example from joonaleppalahti’s github:
I ran the command to test it: master$ sudo salt ‘*’ state.apply test.
I wanted to change my Windows wallpaper via salt, but I ran out of time. I managed to copy the desired image file where I wanted to in windows, but I could not manage to make it the wallpaper.
Sources and documentation used: