Skip to content

Instantly share code, notes, and snippets.

_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}"
#!/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
@devinnasar
devinnasar / setup-salt.sh
Created May 18, 2017 13:40
Original bootstrapping script
#!/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
pygit-deps: # State
pkg.group_installed:
- name: Development Tools
pkg.installed:
- pkgs:
- cmake
- gcc
- http-parser-devel
# Remote pillar information
2017-05-23 18:08:19,546 [salt.utils.gitfs ][DEBUG ][11994] Fetching git_pillar remote 'master git@bitbucket.org:opentempo/salt-pillar.git'
2017-05-23 18:08:19,747 [salt.utils.gitfs ][DEBUG ][11994] git_pillar remote 'master git@bitbucket.org:opentempo/salt-pillar.git' is up-to-date
2017-05-23 18:08:19,748 [salt.utils.gitfs ][DEBUG ][11994] pygit2 does not support detecting stale refs for authenticated remotes, saltenvs will not reflect branches/tags removed from remote 'master git@bitbucket.org:opentempo/salt-pillar.git'
2017-05-23 18:08:19,748 [salt.utils.gitfs ][DEBUG ][11994] Removed update lock for git_pillar remote 'master git@bitbucket.org:opentempo/salt-pillar.git'
# Attempted highstate.
[root@OTCMVM0000 master.d]# salt -G 'role_code:CM' state.apply highstate
[DEBUG ] Configuration file path: /etc/salt/master
[WARNING ] In
[root@OTCMVM0000 master.d]# salt-run git_pillar.uplate -l trace
[DEBUG ] Missing configuration file: /etc/salt/master
[DEBUG ] Including configuration from '/etc/salt/master.d/engine.conf'
[DEBUG ] Reading configuration from /etc/salt/master.d/engine.conf
[DEBUG ] Including configuration from '/etc/salt/master.d/f_defaults.conf'
[DEBUG ] Reading configuration from /etc/salt/master.d/f_defaults.conf
[DEBUG ] Including configuration from '/etc/salt/master.d/lxc_profiles.conf'
[DEBUG ] Reading configuration from /etc/salt/master.d/lxc_profiles.conf
[DEBUG ] Including configuration from '/etc/salt/master.d/reactor.conf'
[DEBUG ] Reading configuration from /etc/salt/master.d/reactor.conf
[root@OTCMVM0000 master.d]# salt-run git_pillar.update -l trace
[DEBUG ] Missing configuration file: /etc/salt/master
[DEBUG ] Including configuration from '/etc/salt/master.d/engine.conf'
[DEBUG ] Reading configuration from /etc/salt/master.d/engine.conf
[DEBUG ] Including configuration from '/etc/salt/master.d/f_defaults.conf'
[DEBUG ] Reading configuration from /etc/salt/master.d/f_defaults.conf
[DEBUG ] Including configuration from '/etc/salt/master.d/lxc_profiles.conf'
[DEBUG ] Reading configuration from /etc/salt/master.d/lxc_profiles.conf
[DEBUG ] Including configuration from '/etc/salt/master.d/reactor.conf'
[DEBUG ] Reading configuration from /etc/salt/master.d/reactor.conf
@devinnasar
devinnasar / gist:5ce84967251d5c08465d52cc56e486ca
Created May 24, 2017 19:27
salt-cloud doesn't like my profile...
# provider
aws-ec2-east:
driver: ec2
id: <obfuscated>
key: <obfuscated>
keyname: salt-e
minion:
master: <obfuscated>
private_key: /root/.ssh/salt-e.pem
ssh_interface: private_ips
@devinnasar
devinnasar / gist:3948416b9657ba4d3715ea8c9f5ce156
Created May 26, 2017 15:53
What's going on here? It ran the first state then said it couldn't find the second state
ID: clamd_config
Function: file.managed
Name: /etc/clamd.d/scan.conf
Result: True
Comment: File /etc/clamd.d/scan.conf updated
Started: 15:50:58.259184
Duration: 168.688 ms
Changes:
----------
diff:
# State
# Blacklist
ipset_set_blacklist_exists:
ipset.set_present:
- name: blacklist
- set_type: hash:ip
- hashsize: 4096
- family: ipv4
- comment: blackist