SALTSTACK: CUSTOMISE WORKSTATIONS

GOAL

  • With Salt:
    • change motd (message of the day)
    • change desktop background
    • create state installing essential software

PERQUISITES:

SaltStack installed on the machines.
https://juhosyrjanen.com/2015/11/05/salty-assignment-i-saltstack/

ENVIRONMENT:

Three virtual machines.
VM1: Running Mint 17.2, Salt master || specs
VM2: Running Mint 17.2, Salt minion
VM3: Running Mint 17.2, Salt minion

MOTD

Message of the day can be easily changed by editing the /etc/motd -file.

To do this, I created a new module for Salt, init.sls -file for the module and also a new file to be used as the new motd.
I decided to use a template engine to do this, hence the naming of the file.
Capture1

The init.sls file is build as follows:

#!pyobjects

File.managed("/etc/motd",source="salt://motd/motd.jinja",template="jinja")

I tested that the state runs normally.

Capture2

No errors. Next I modified the motd.jinja -file to create a customised message with the IP of the host using Salt grains.

Motd.jinja is built as follows:
Capture3

I ran the state again and then used ssh to connect to my local machine.

Capture4

Motd has been successfully changed.

BACKGROUND

Changing desktop wallpaper on is done rather simply by overriding the default background binary file.

I created a state for this before and it can be found in a previous article. 

ESSENTIAL SOFTWARE

Installing essential software is done easily with a state using Pkg.installed.  You can just create a new state and list wanted software with Pkg.installed(“nameofsoftware”). For example, I created this state with a list of some software I would use.

Capture5

If you install software that requires configuration prior to use, you can do that with File.managed – and edit the conf files. In the way shown above with motd.

I ran the state locally. It can as well be deployed to slaves using salt ‘*’.

Capture6

It took a while to process..

Capture7 Capture8

Done, and my software is here too.

+ FIREFOX SETTINGS

– – Work in progress

 

 

  • Copying, modifying and redistributing this and all the other documents in this blog is allowed according to the GNU General Public License (versio 2 or newer).http://www.gnu.org/licenses/gpl.html
  • Based on the Linux course by Tero Karvinen 2015: terokarvinen.com
Advertisements

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s