Skip to content

Instantly share code, notes, and snippets.

View jondkelley's full-sized avatar
:octocat:

Jonathan D Kelley jondkelley

:octocat:
View GitHub Profile
# foreman-installer \
> --enable-foreman-proxy \
> --foreman-proxy-tftp=true \
> --foreman-proxy-tftp-servername=199.116.255.106 \
> --foreman-proxy-dhcp=true \
> --foreman-proxy-dhcp-interface=eno1 \
> --foreman-proxy-dhcp-gateway= \
> --foreman-proxy-dhcp-nameservers="199.116.255.106" \
> --foreman-proxy-dns=true \
> --foreman-proxy-dns-interface=eno1 \

Managing Xen Images

On a hypervisor host

Restoring from a backup from backup server

If restoring a hypervisor, setup the backups to the point of step 1.9 Test NFS mount

On the hypervisor, run

mount -t nfs -o port=3049 localhost:/mnt/data /mnt/nfs/data

Part 1: Build encrypted tunnel from Xen (HYPERVISOR) to Backup server

ONLY SET THIS UP ON MASTER HOSTS

1.1 Temporarily enable Redhat repositories & perform autossh installation

sudo yum -y --enablerepo=base --enablerepo=updates --enablerepo=extras --enablerepo=base --enablerepo=centosplus install epel-release
sudo yum -y --enablerepo=base --enablerepo=updates --enablerepo=extras --enablerepo=base --enablerepo=centosplus install autossh
#!/usr/bin/python2.7
# -*- coding: utf-8 -*-
# Written by Jonathan Kelley, March 7, 2018
# March 12, Added config support from yaml..
#pip2.7 install netmiko
#pip2.7 install --upgrade paramiko
#pip2.7 install cryptography
#pip2.7 uninstall gssapi
#pip2.7 install unidecode
@jondkelley
jondkelley / mongo_cheats.md
Last active May 30, 2018 14:18
Mongo Cheat Sheet

Check current storage engine

db.serverStatus().storageEngine

Add new replicaSet members

config = { _id: "bogus-replica-set", members:[
          { _id : 0, host : "192.168.42.200:27017"},
 { _id : 1, host : "192.168.42.210:27017"}
@jondkelley
jondkelley / varnish_newrelic_plugin.py
Last active June 18, 2018 16:49
newrelic varnish python plugin
#!/usr/bin/env python
# python 2.6.6 compatible
# Goes through list of customizable varnish metrics and reports to newrelic
# requires config in /etc/newrelic/newrelic_varnish_agent.ini
# sample config:
# [varnish]
# instance: ___varish_instance_name___
# metrics: sess_conn,client_req,backend_fail,cache_miss,threads,threads_created,threads_failed,threads_limited,sess_drop,n_lru_nuked,esi_errors,n_expired
# [newrelic]
# license_key: ___key___
---
- name: experiment
hosts: box
tasks:
- debug:
msg: "before we run our role"
- name: Run a task from a role
include_role:
name: rolename
@jondkelley
jondkelley / compare shit
Created June 26, 2018 21:18
compare shit between t3wo servers
$ diff -U0 <(ssh lproxy5 'ls /etc/hapee-1.7/ssl') <(ssh lproxy6 'ls /etc/hapee-1.7/ssl')
--- /dev/fd/63 2018-06-26 16:15:26.000000000 -0500
+++ /dev/fd/62 2018-06-26 16:15:26.000000000 -0500
@@ -2 +1,0 @@
-bt-wild-haproxy.pem
@jondkelley
jondkelley / twitter_follow.py
Last active August 29, 2018 06:44
Fetch Tweets Using Python3
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""A tool to fetch limit N number of twitter posts from twitter handle
Usage:
twitter_follow --handle HANDLE [--limit NUMBER]
twitter_follow -h
Options:
-h show help
@jondkelley
jondkelley / smtpserver-python37.py
Last active September 19, 2018 01:00
Example of how to overload custom SMTP commands in asyncio smtp server in python3 (no proxy or mailbox capability shown)
#!/usr/bin/env python3
# pip3 install aiosmtpd
import asyncio
from aiosmtpd.controller import Controller
from aiosmtpd.handlers import AsyncMessage
from aiosmtpd.smtp import SMTP, syntax
import logging
import uuid
import logging