Skip to content

Instantly share code, notes, and snippets.

View djoreilly's full-sized avatar

Darragh O'Reilly djoreilly

View GitHub Profile
@djoreilly
djoreilly / mk-vxlan.sh
Created February 17, 2020 10:08
Linux VxLAN performance test setup script
#!/bin/bash
set -xe
# $0 host dev remote_ip
# host is 1 or 2
# on vmA
# ./mk-vx.sh 1 ens3 10.10.10.9
# on vmB
# ./mk-vx.sh 2 ens3 10.10.10.15
@djoreilly
djoreilly / dump-vm-neutron-info.py
Created January 15, 2020 16:08
Gather neutron info for VM connectivity problems
"""
Script to gather neutron info for vm connectivity problems.
Gets the vm's ports, networks, subnets, security groups
and router, external networks and floatingips.
source .openrc admin
python dump-vm-neutrn-info.py VM_ID
"""
import sys
import os_client_config
# Search nova-compute.log for ports that took a long time
# to receive the network-vif-plugged- event from neutron.
# python find_slow_boot.py /var/log/nov/nova-compute.log | sort -k 3
import datetime
import re
import sys
if len(sys.argv) == 2:
log_file = sys.argv[1]
@djoreilly
djoreilly / meta_svr.py
Last active July 15, 2025 18:13
Metadata server to allow booting cloud-init images on Libvirt
"""
Server to answer requests from Libvirt VMs to http://169.254.169.254/
Cloud images usually don't have a preset user/password, and this is needed to add a ssh pub key to .ssh/authorized_hosts.
Change SSH_PUB_KEY path below.
pip install bottle
sudo ip address add 169.254.169.254 dev virbr0
open firewall
-A ufw-user-input -s 192.168.122.0/24 -d 169.254.169.254/32 -i virbr0 -p tcp -m tcp --dport 80 -j ACCEPT
@djoreilly
djoreilly / read-rabbit-cap.py
Last active February 21, 2019 17:18
Pretty print an OpenStack Olso messaging packet capture
'''
Pretty print an OpenStack Oslo messaging packet capture.
tcpdump -ni ethX tcp port 5672 -w rabbit.cap
python read-rabbit-cap.py rabbit.cap
python read-rabbit-cap.py rabbit.cap | grep -v context
'''
import json
@djoreilly
djoreilly / json2yaml.py
Created May 17, 2018 16:26
Convert json to yaml
#!/usr/bin/env python3
import sys, json, yaml
yaml.dump(json.loads(sys.stdin.read()), sys.stdout, default_flow_style=False)
@djoreilly
djoreilly / j2-render.py
Created March 27, 2018 11:30
Render Jinja2 template
#!/usr/bin/python
import sys
import yaml
import jinja2
if len(sys.argv) != 3:
print "Usage: %s yaml template" % sys.argv[0]
sys.exit(1)
@djoreilly
djoreilly / bgpd.conf
Last active October 8, 2024 22:30 — forked from heri16/bgpd.conf
AWS VPC VPN StrongSwan Virtual Tunnel Interface (VTI)
#@ /etc/quagga/bgpd.conf (Centos & Ubuntu)
hostname <Local OS hostname>
password <Any random phrase>
enable password <Any random phrase>
!
log file /var/log/quagga/bgpd
!debug bgp events
!debug bgp zebra
debug bgp updates
@djoreilly
djoreilly / stack.yaml
Created February 16, 2018 18:12
Cloudformation example
AWSTemplateFormatVersion: 2010-09-09
# aws cloudformation create-stack --stack-name test-stack --template-body file://stack.yaml
# aws cloudformation describe-stacks --stack-name test-stack
# aws cloudformation describe-stack-events --stack-name test-stack
# aws cloudformation update-stack --stack-name test-stack --template-body file://stack.yaml
Description: VPC, SGs, instances
Parameters:
@djoreilly
djoreilly / mk_ansible_inv.py
Last active June 19, 2018 15:31
Builds an Ansible inventory file with RHOS overcloud nodes.
#!/usr/bin/python
'''
Builds an Ansible inventory file with RHOS overcloud nodes.
On director:
source ~/stackrc
./mk_ansible_inv.py >hosts
ansible all -i hosts -m shell -a "/usr/sbin/ip -4 a"
ansible controllers -i hosts -m shell -a "uptime"
TODO add storage and ceph nodes