Skip to content

Instantly share code, notes, and snippets.

@trebortech
trebortech / README
Last active May 26, 2023 19:25
salt-ssh example
The goal of this test was to build an orchestration file that can execute commands on a non-minion via salt-ssh.
<event> -> <reactor> -> <reactor sls> -> <orchestration file> -> <ssh commands>
Flow:
- salt-call event.send ssh/test '{"hostid": "minion-deb8-py2"}'
- event is dropped on the eventbus with a hostid to target commands
- reactor file triggers orchestration
@trebortech
trebortech / salt-lowdata-formats.rst
Created January 7, 2023 17:21 — forked from whiteinge/salt-lowdata-formats.rst
Salt is used to execute functions across a wide variety of locations in a wide variety of ways. It does this by mapping the function name and function parameters within a data structure (JSON-serializable). Unfortunately, there is a variety of formats in different parts of Salt for doing so.

Various formats of mapping data to function calls in Salt

Note

Legend

mod

Module name

fun

Function name (in module)

@trebortech
trebortech / hsm_list.config
Created June 22, 2022 19:23
Multiple YubiHSM startup shell script
connector_path=/home/pi/yubihsm/yubihsm-connector
hsm1_serial=123456
hsm1_listen=172.16.16.10:1111
hsm2_serial=4234234
hsm2_listen=172.16.16.10:2222
@trebortech
trebortech / setpinretries.py
Last active February 10, 2018 16:30
SetPinRetries
# Core lib imports
from binascii import a2b_hex
# Yubico lib imports
from ykman import driver_ccid as CCID
from ykman import piv as PIV
objCCIDDevices = CCID.open_devices()
driverCCID = objCCIDDevices.next()
@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
@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 / 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 / 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
susemanager:
activation_key: 1-Dev-SLES-11-SP3-x86_64-key
roles:
- linux-dev
- mybox-acme
AFAIK:
key: value
key:
@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