SaltStack, Salt Minions and Solaris11

whiteABOVEweb-01Salt / SaltStack is a tool one can use to handle remote execution of code, deployments and other configuration or maintenance across hundreds or thousands of servers.  It’s command line / shell based, quick, simple and effective.  It uses a Master / Minion setup where commands are issued from the Master to all the Minions.  You can target individual minions, groups or all Minions with your request.  It works across Unix, Linux and Windows based servers.  (It’s very similar to Puppet, Chef and other Dev Ops / Sys Admin tools.)  Find out more about Salt Here http://saltstack.com/  or RTFM here – https://docs.saltstack.com/en/latest/contents.html

 

Script or unscripted install of Salt is actually quite trivial, completely removing it not so much.

Salted Solaris

sol11desktopEnclosed is a Solaris shell script that handles most of the install of a Salt Minion on a Solaris11 machine, including configuring the master and minion ID.  Execute the script, choose the CSW Package, and then pass it a ‘Y’ and within minutes you have a fully configured Salt Minion, targeting your Salt Master. (In the script the master is referred to as $SALT_MASTER, update that variable with the FQDN of your Master.)

The script is also set up to take the boxes $HOSTNAME as the Minion ID, identifiable by the master. After the script completes all you must do is issue a ‘salt -A’ from your Master, or ‘salt -a $HOSTNAME’ to accept the minion as a minion.  I’m sure it’s possible to further automate the enclosed script or make it more slick, I’m just not that good.  😉

Also enclosed is a script that fully removes Salt from a Solaris system.  One of our test boxes would remove Salt, but leave all sorts of dependences that made it tricky to re-install the Salt Minion.  As such we basically just reverse engineered the install process, nothing too fancy there, but it works.

Last thing, be advised that the Solaris Salt-Minions is wildly behind the current Linux / Windows versions.  At the time of this posting the current version of Salt was 2015.5.8, whereas what Solaris installs is 0.14.0.  (To check issue the ‘salt-run manage.versions’ command from your master, you’ll likely get notified that your Solaris Minions are out of date.)

All in all these scripts may save you 5-10 minutes of your life, but if they do, please buy me a shot or make a donation to one of my supported charities.

#INSTALL_SALT_MINION.sh

#/bin/bash

sudo -v

#printf ‘1\ny’ | pkgadd -d http://get.opencsw.org/now   #type y to continue
pkgadd -d http://get.opencsw.org/now   #type y to continue

#Once PKGUtil is installed you’ll need to edit it’s config file /etc/opt/csw/pkgutil.conf to point it at the unstable #catalog: (ex. ‘mirror=http://mirror.opencsw.org/opencsw/unstable’)
#> vi pkgutil.conf

#PRODUCTION SALT VARIABLES
echo SETTING VARS
SALTPKG=/etc/opt/csw/pkgutil.conf
MINIONCONFIG=/etc/opt/csw/salt/minion

echo $SALTPKG
echo $MINIONCONFIG

#TESTING VARIABLES
#SALTPKG=testfile #testing file – remove before deployment
#MINIONCONFIG=testfile #testingfile – remove before deployment

#FIX SALT PKGUTIL SOURCE
echo FIX SALT SOURCE
sed s/#http/http/g $SALTPKG > $SALTPKG.new && mv $SALTPKG.new $SALTPKG && sed s/”\/testing”/”\/unstable”/g $SALTPKG > $SALTPKG.new && mv $SALTPKG.new $SALTPKG

#UPDATE PKGUTIL
echo UPDATE PKGUTIL
/opt/csw/bin/pkgutil –U

#INSTALL SALT
echo INSTALL SALT
/opt/csw/bin/pkgutil -i -y py_salt

sudo /opt/csw/bin/pkgutil -i -y python27
sudo /opt/csw/bin/pkgutil -i -y py_pip
sudo /opt/csw/bin/pkgutil -i -y py_pyzmq
sudo /opt/csw/bin/pkgutil -i -y py_m2crypto
sudo /opt/csw/bin/pkgutil -i -y py_crypto

#SET SALT MINION ID TO FQDN HOSTNAME
echo UPDATE MINION ID
cd /etc/opt/csw/salt
sed s/”#id:”/”id: $HOSTNAME”/ $MINIONCONFIG > $MINIONCONFIG.new && mv $MINIONCONFIG.new $MINIONCONFIG

#SET SALT MASTER
echo SET MASTER
sed s/”#master: salt”/”master: $SALT_MASTER”/ $MINIONCONFIG > $MINIONCONFIG.new && mv $MINIONCONFIG.new $MINIONCONFIG

#START SALT SERVICE
svcadm enable salt-minion
svcs -a | grep salt

 

6ac8c966d29414832d4b904a97291c80

 

 

#CLEAN_SALT_MINION.sh

sudo /opt/csw/bin/pkgutil -r -y -f CSWalternatives
sudo /opt/csw/bin/pkgutil -r -y -f CSWbdb48
sudo /opt/csw/bin/pkgutil -r -y -f CSWcacertificates
sudo /opt/csw/bin/pkgutil -r -y -f CSWcas-initsmf
sudo /opt/csw/bin/pkgutil -r -y -f CSWcas-migrateconf
sudo /opt/csw/bin/pkgutil -r -y -f CSWcas-preserveconf
sudo /opt/csw/bin/pkgutil -r -y -f CSWcas-pycompile
sudo /opt/csw/bin/pkgutil -r -y -f CSWcas-texinfo
sudo /opt/csw/bin/pkgutil -r -y -f CSWcommon
sudo /opt/csw/bin/pkgutil -r -y -f CSWcoreutils
sudo /opt/csw/bin/pkgutil -r -y -f CSWcswpki
sudo /opt/csw/bin/pkgutil -r -y -f CSWggettext-data
sudo /opt/csw/bin/pkgutil -r -y -f CSWgnupg
sudo /opt/csw/bin/pkgutil -r -y -f CSWiconv
sudo /opt/csw/bin/pkgutil -r -y -f CSWisaexec
sudo /opt/csw/bin/pkgutil -r -y -f CSWlibbz2-1-0
sudo /opt/csw/bin/pkgutil -r -y -f CSWlibcharset1
sudo /opt/csw/bin/pkgutil -r -y -f CSWlibcurl4
sudo /opt/csw/bin/pkgutil -r -y -f CSWlibffi5
sudo /opt/csw/bin/pkgutil -r -y -f CSWlibffi6
sudo /opt/csw/bin/pkgutil -r -y -f CSWlibgcc-s1
sudo /opt/csw/bin/pkgutil -r -y -f CSWlibgdbm4
sudo /opt/csw/bin/pkgutil -r -y -f CSWlibgmp10
sudo /opt/csw/bin/pkgutil -r -y -f CSWlibiconv2
sudo /opt/csw/bin/pkgutil -r -y -f CSWlibicudata54
sudo /opt/csw/bin/pkgutil -r -y -f CSWlibicuuc54
sudo /opt/csw/bin/pkgutil -r -y -f CSWlibidn11
sudo /opt/csw/bin/pkgutil -r -y -f CSWlibintl8
sudo /opt/csw/bin/pkgutil -r -y -f CSWliblber2-4-2
sudo /opt/csw/bin/pkgutil -r -y -f CSWlibldap2-4-2
sudo /opt/csw/bin/pkgutil -r -y -f CSWlibncurses5
sudo /opt/csw/bin/pkgutil -r -y -f CSWlibpanel5
sudo /opt/csw/bin/pkgutil -r -y -f CSWlibpsl0
sudo /opt/csw/bin/pkgutil -r -y -f CSWlibpython2-6-1-0
sudo /opt/csw/bin/pkgutil -r -y -f CSWlibpython2-7-1-0
sudo /opt/csw/bin/pkgutil -r -y -f CSWlibreadline6
sudo /opt/csw/bin/pkgutil -r -y -f CSWlibsasl2-2
sudo /opt/csw/bin/pkgutil -r -y -f CSWlibsqlite3-0
sudo /opt/csw/bin/pkgutil -r -y -f CSWlibssl1-0-0
sudo /opt/csw/bin/pkgutil -r -y -f CSWlibyaml0-2
sudo /opt/csw/bin/pkgutil -r -y -f CSWlibz1
sudo /opt/csw/bin/pkgutil -r -y -f CSWlibzmq1
sudo /opt/csw/bin/pkgutil -r -y -f CSWpkgutil
sudo /opt/csw/bin/pkgutil -r -y -f CSWpy-crypto
sudo /opt/csw/bin/pkgutil -r -y -f CSWpy-jinja2
sudo /opt/csw/bin/pkgutil -r -y -f CSWpy-m2crypto
sudo /opt/csw/bin/pkgutil -r -y -f CSWpy-markupsafe
sudo /opt/csw/bin/pkgutil -r -y -f CSWpy-msgpack-python
sudo /opt/csw/bin/pkgutil -r -y -f CSWpy-pip
sudo /opt/csw/bin/pkgutil -r -y -f CSWpy-pyzmq
sudo /opt/csw/bin/pkgutil -r -y -f CSWpy-salt
sudo /opt/csw/bin/pkgutil -r -y -f CSWpy-setuptools
sudo /opt/csw/bin/pkgutil -r -y -f CSWpy-yaml
sudo /opt/csw/bin/pkgutil -r -y -f CSWpython27
sudo /opt/csw/bin/pkgutil -r -y -f -f CSWterminfo
sudo /opt/csw/bin/pkgutil -r -y -f -f CSWterminfo-rxvt-unicode