Using jinja template to make a state which adds a variable into a file.
I started by creating a new folder in the /srv/salt directory, simply called ‘jinjatest’.
Into this new folder I created a text file called monkey.txt
Then I created an .sls file called ‘monkeycall’.
I ran the state and it worked.
SLS states and for-in loop with Jinja
I made an sls state which utilized the jinja for-in loop. I started the assignment by creating a folder called ‘files’ into the /srv/salt directory.
Then I proceeded to make an .sls file called makefiles.sls
I tried to use my previous .txt file monkey as a source, but when I ran the state it didn’t yield good results.
So I decided to make sure that I could get this for-in loop to work and used code from Jinja template tutorial by Tero Karvinen as a base to get results.
Installing SSH demon into a selected port
Trying out a salt state made by a fellow student
For this assignment I decided to use the salt state made by Lauri Mattila which installs
the nmap and ack programs.
Nmap is a security scanner that builds a ‘map’ of a network by discovering hosts and services on it.
‘ack’ on the other hand is a command line utility similar to ‘grep’, but it uses shorter commands and you can use simple filetype specifications to search source code for anything you want.
It’s always important to check what the programs do before installing them, even if you’re using code from a trusted friend.
I made a new .sls file into the /srv/salt directory called programscopy.sls
Then I ran sudo salt ‘*’ state.apply programscopy and saw that the state worked as planned.