Skip to content

Instantly share code, notes, and snippets.

@trebortech
trebortech / vbox.py
Created September 3, 2015 17:39
vbox python script to clone vm
def cloneVm(ctx, srcname, newname):
vbox = ctx['vb']
clonemode = ctx['const'].all_values('CloneMode')
sourcevm = vbox.findMachine(srcname)
mach = vbox.createMachine("", newname, [], sourcevm.OSTypeId, "")
clone = sourcevm.cloneTo(mach, clonemode['MachineState'], "")
mach.saveSettings()
print "created clone of machine with UUID", mach.id
vbox.registerMachine(mach)
# update cache
@trebortech
trebortech / NOTES
Created November 5, 2015 03:14
VMWare Provider Example
Provider file
- The provider id name is tt-vmware
- This provider is using the vmware provider module as specified with provider: vmware
Profile file
- You might not need script_args unless you have problems bootstrapping the new instance. The line I have here installs a version from github using a tag version
- provider is the name I have as the id in the provider file NOT THE FILE NAME
- clonefrom is an image I already have ready in vSphere named Ubuntu-1404
@trebortech
trebortech / notes
Created February 15, 2016 15:58
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
@trebortech
trebortech / GPG-Salt-Prod.md
Created February 18, 2016 01:25 — forked from ytjohn/GPG-Salt-Prod.md
GPG-Salt-Prod.md

GPG In Pillar

Include this file in the git repo with your pillar data. It provides instructions for those commiting code to securely save and commit senstive data (like password and private certs).

This the Salt Prod key:

key A1234567: "Salt Prod [email protected]"

@trebortech
trebortech / main.sh
Created April 13, 2016 18:02
Command line prompt
# Regular
txtblk="$(tput setaf 0 2>/dev/null || echo '\e[0;30m')" # Black
txtred="$(tput setaf 1 2>/dev/null || echo '\e[0;31m')" # Red
txtgrn="$(tput setaf 2 2>/dev/null || echo '\e[0;32m')" # Green
txtylw="$(tput setaf 3 2>/dev/null || echo '\e[0;33m')" # Yellow
txtblu="$(tput setaf 4 2>/dev/null || echo '\e[0;34m')" # Blue
txtpur="$(tput setaf 5 2>/dev/null || echo '\e[0;35m')" # Purple
txtcyn="$(tput setaf 6 2>/dev/null || echo '\e[0;36m')" # Cyan
susemanager:
activation_key: 1-Dev-SLES-11-SP3-x86_64-key
roles:
- linux-dev
- mybox-acme
AFAIK:
key: value
key:
@trebortech
trebortech / custom_aws_grains.py
Created May 18, 2016 15:12
AWS custom grains
#!/usr/bin/env python
# encoding: utf-8
# Standard Libs
import logging
# First Party Libs
import requests
from requests.adapters import HTTPAdapter
@trebortech
trebortech / modules list
Created June 10, 2016 23:37
Module list
aliases.get_target
aliases.has_target
aliases.list_aliases
aliases.rm_alias
aliases.set_target
alternatives.auto
alternatives.check_exists
alternatives.check_installed
alternatives.display
alternatives.install
@trebortech
trebortech / 1-README
Last active January 24, 2017 20:52
badlogins beacon
Here are all the files necessary to setup a beacon to monitor bad logins on Linux machines
BEACON SETUP
1. Copy "badlogins.sls" to /srv/pillar
2. Update your pillar top file to include the information from "top.sls"
-- You might need to restart the salt-minion agent for the beacon to start immediatly otherwise it could take a few hours.
@trebortech
trebortech / SaltStack Glossary
Created March 8, 2017 12:49
SaltStack Glossary
Event
A notice emitted onto an event bus. Events are often driven by requests for actions to occur on a minion or master and the results of those actions.
File Server
A local or remote location for storing both Salt-specific files such as top files or SLS files as well as files that can be distributed to minions, such as system configuration files.
Grain
A key-value pair which contains a fact about a system, such as its hostname, network addresses.
Highstate