Skip to content

Instantly share code, notes, and snippets.

View aleks-mariusz's full-sized avatar

aleks aleks-mariusz

  • London, UK (formerly NYC)
View GitHub Profile
{
"cniVersion": "0.4.0",
"name": "podman",
"plugins": [
{
"type": "bridge",
"bridge": "cni-podman0",
"isGateway": true,
"ipMasq": false,
"ipam": {
@aleks-mariusz
aleks-mariusz / sync-all.sh
Created August 20, 2019 13:42
yum repo sync script
#!/usr/bin/env bash
EL_VERSION=7
LOG=/tmp/.sync-attempt-out.$$
TIMESTAMP_FILE=/var/tmp/.sync-newer.$$
YUM_BASE=/data/yum${EL_VERSION}
YUM_REPOS_DIR=/etc/yum${EL_VERSION}.repos.d
YUM_CONF=/etc/yum_${EL_VERSION}.conf
@aleks-mariusz
aleks-mariusz / 06-fluentd-daemonset.yaml
Last active September 25, 2018 18:35
set of fluentd configs for kubernetes aggregated logging into elasticsearch using fluentd, on k8s v1.11+ using docker 1.13+ on centos 7 - kubectl apply the 06-fluentd-daemonset.yaml after placing the other files below into a directory (such as "fluentd-configs") and create configmap using: kubectl -n monitoring create configmap es-fluentd --from…
---
# Source: fluentd-elasticsearch/templates/service-account.yaml
apiVersion: v1
kind: ServiceAccount
metadata:
name: es-fluentd
namespace: monitoring
labels:
app: fluentd
kubernetes.io/cluster-service: "true"
@aleks-mariusz
aleks-mariusz / node1.sh
Last active July 30, 2018 08:36
kubernetes v1.11.1 - HA setup scripts for centos 7.x used (kickstart file used: https://gist.github.com/aleks-mariusz/f01f3177a13f1e86e4088e5b6c7f278d) - need to also set up keepalived on 2nd/3rd node and replace socat with nginx
#!/bin/sh
INTERFACE=eth0
NETMASK_CIDR='/24' # 255.255.255.0
LOAD_BALANCER_IP=192.168.1.100
LOAD_BALANCER_DNS=api-k8s-lab
LOAD_BALANCER_PORT=6443
CP_PORT=6443
CP0_HOSTNAME=k8s-lab1
@aleks-mariusz
aleks-mariusz / key_dist.py
Last active April 26, 2017 23:02
used to distributing keys to different systems uniquely.. takes on standard input and distributes it uniquely to all clients hitting the /k endpoint
#!/usr/bin/env python
import atexit
import functools
import gzip
import itertools
import logging
import os
import socket
import sys
@aleks-mariusz
aleks-mariusz / find_stale_metrics.py
Created February 9, 2017 21:52
This utiilty helps to find metrics in graphite whisper format that haven't been updated in a preset number of days
#!/usr/bin/python
import optparse # argparse not available since most systems still have python 2.6 (argparse is in 2.7)
import os
import sys
import time
# helper function to return the parent dir given a dir
parent_of = lambda p: os.path.sep.join( p.split( os.path.sep )[:-1] )
@aleks-mariusz
aleks-mariusz / post-install
Last active January 12, 2017 14:22
xenserver7 automated (unattended) installation using cobbler, a trigger script to work with cobbler.sync, also the post-install depends on this answerfile (treated as a kickstart file by cobbler) - sets up small OS partition, and whatever left over space as the xen-storage-repository, installs gluster, and if two disks of same size seen, mirrors…
#!/bin/bash
if [[ $1 -ne 0 ]]; then
echo "ERROR: failed install, backing out changes"
mdadm --stop /dev/md{0,1,2,3}
mdadm --zero-superblock /dev/sd{a,b}{1,4,5,6}
sgdisk --zap /dev/sdb
exit
fi
@aleks-mariusz
aleks-mariusz / centos75-minimal.ks
Last active July 26, 2018 18:06
got centos 7.5 down to about 180 packages - around 600 meg installed, note: i removed xfsprogs because i'm using ext2, if you use xfs you may want to remove e2fs* instead
install
skipx
text
eula --agreed
lang en_US.UTF-8
keyboard us
timezone Europe/London
# Use network installation
@aleks-mariusz
aleks-mariusz / prep-graphite-db.py
Last active November 9, 2016 17:33
this script preps the sqlite db used by the web-app graphite after initial install by populating it with a default user, preventing a potential race condition resulting in a deadlock requiring the httpd server to be restarted after the first run
#!/usr/bin/env python
import hashlib
import hmac
import random
import sqlite3
import string
from base64 import b64encode
from itertools import izip, starmap
@aleks-mariusz
aleks-mariusz / osmaps-mobac.py
Last active March 18, 2017 18:04
this will download the geojson for ordinance survey's maps, parse it and create mobac-profiles for their explorer/landranger series of maps
#!/usr/bin/env python
import argparse
import itertools
import json
import math
import os
import re
import sys
import urllib2