Skip to content

Instantly share code, notes, and snippets.

@trebortech
Created February 15, 2016 15:58
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save trebortech/0e137bea9c2196f90b24 to your computer and use it in GitHub Desktop.
Save trebortech/0e137bea9c2196f90b24 to your computer and use it in GitHub Desktop.
Salt the easy way
The following instructions will help you easily deploy out a SaltStack Master server with some basic settings.
Step 1.
Install docker on your machine where you want to run your SaltStack master. If you want to run this on Windows you could install virtualbox and deploy our a Linux VM that has docker installed on it. Additional network setup instructions are available upon request.
https://docs.docker.com/engine/installation/
Step 2.
Confirm docker is installed and running correctly
--> docker ps
Step 3.
Download the image to your local docker host.
--> docker pull saltme/poc-master:v2015.8.3-2
​Step 4.
Start a container with the downloaded image.
--> docker run -d -p 2222:22 -p 4505:4505 -p 4506:4506 -p 8000:8000 saltme/poc-master:v2015.8.3-2​
​Step 5.
Confirm the container is running.
--> docker ps
The results should show the new container running
Step 6.
Log into your container
--> ssh -p 2222 salt@dockerhostip​
​password = saltme
Step 7.
Accept the minion key for the master
--> salt-key -a saltmaster
-------------------------------------------------
At this point your SaltStack master is running.
The following are extra instructions to initialize certain parts of your installation
Restart your instance
If you update a configuration setting and you need to restart salt you must do this at the docker host level and not in your ssh session.
--> docker restart containerid
Restart your docker host
If you need to restart your docker host you should first stop the container that is running your SaltStack master.
--> docker stop containerid
--> Restart docker host
--> docker start containerid
NOTE: To get a list of stopped or previously running containers use the following
--> docker ps -a
Initialize Pillar/Reactor information
To pull down a basic set of pillar/reactor files to the /srv/poc/pillar and /srv/poc/reactor directory execute the following after logging into your SaltStack master container.
--> salt-call state.sls poc
Initialize cloud profile/provider files
This state file will install basic files for your cloud provider and cloud profiles.
--> salt-call state.sls poc.cloud-init
Provide VMWare support (with additional feature of windows custimization spec file usage)
--> salt-call state.sls poc.pyvmomi-v5
--> salt-call state.sls poc.vmware-p2
Install Windows bootstrap support
Salt cloud depends on a few files to bootstrap windows machines. If you need to bootstrap windows machines from your master you will need winexe install. This state file will install the necessary files to enable this.
--> salt-call state.sls salt.winexe
This docker container uses gitfs to connect to a public repo that has several state files already configured and waiting to be applied. For example if you wanted to install IIS on a windows minion you could use the following command on the master.
--> salt 'windowsid' state.sls iis
This state file can be viewed at the following URL
https://github.com/trebortech/hoolie-states/blob/salt-poc/iis/init.sls
The repo/branch URL
https://github.com/trebortech/hoolie-states/tree/salt-poc
All of the state files in this branch on this repo are available to you. Once you become more familiar with SaltStack I encourage you to update your master config to point to your own repository.
If you have any questions please feel free to email me. This is a new process and has worked great for current customers but we could have missed a few things. If you see something strange or don't see something that could be helpful please let me know.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment