Skip to content

Instantly share code, notes, and snippets.

@devinnasar
devinnasar / setup-salt.sh
Created May 18, 2017
Original bootstrapping script
View setup-salt.sh
#!/bin/sh
# use the latest stable Salt from repo.saltstack.com
wget -O - https://repo.saltstack.com/apt/ubuntu/14.04/amd64/latest/SALTSTACK-GPG-KEY.pub | sudo apt-key add -
sudo echo 'deb http://repo.saltstack.com/apt/ubuntu/14.04/amd64/latest trusty main' > /etc/apt/sources.list.d/saltstack.list
sudo apt-get update -y
sudo apt-get install salt-master -y
sudo apt-get install salt-minion -y
# setup top files to test the formula
View bootstrap_salt_master_from_formula_aws.sh
#!/bin/sh
# Bootstaps a SaltStack master server
# salt-formula configures the salt master using salt itself. This includes establishing connections allowing salt to serve assets from git and s3 endpoints.
# Before this can happen, we need to perform a lightweight saltstack installation, clone salt-formula, and call a salt highstate.
# Note: The state and pillar for this formula stay in the repo from the formula and are copied into /srv/salt and /srv/pillar upon invocation of this script.
# This repo will be the source of truth for our state and pillar tops, even though we will recieve configuration via gitfs.
# Instructions
View system_health.sh
_collect_soc_workpaper_files() {
_id="${1}"
declare -a _source_file_paths=("${!2}")
_dest_file_path="${3}"
_id_dest_path="${_dest_file_path}/${_id}"
mkdir "${_id_dest_path}"
for _path in "${_source_file_paths[@]}"; do
cp -a "${_path}" "${_id_dest_path}"