Skip to content

Instantly share code, notes, and snippets.

View trapier's full-sized avatar

Trapier Marshall trapier

  • Raleigh, NC USA
View GitHub Profile
@trapier
trapier / virt-migrate
Created November 16, 2015 19:15
rsync based virsh migrate. minimal downtime and and avoids image bloating due to non-sparse copying.
#!/bin/bash
VM=$1
TARGET=$2
vm_path=/var/lib/libvirt/images/$VM.img
rsync -vS --progress $vm_path root@$TARGET:$vm_path && \
virsh migrate --live --suspend --persistent --undefinesource --verbose $VM qemu+ssh://$TARGET/system && \
rsync -vS --progress $vm_image root@$TARGET:$vm_path && \
@trapier
trapier / fetch_grub.yml
Created September 15, 2015 16:55
fetch grub config from ly8 switches in ansible inventory
---
- hosts: swdut
vars:
platform_search: ly8
tasks:
- name: fetch grub config
fetch: src=/etc/default/grub dest=.
when: ansible_product_name | search(".*ly8.*") or
ansible_cmdline.cl_platform | default(omit) | search(".*ly8.*")
@trapier
trapier / kernel-source-build-recipe.bash
Created August 17, 2015 21:27
bash script to build CumulusLinux 1.5.2 kernel
#!/bin/bash
# prepare extraction directory, get and extract debian sources
mkdir cumulus
cd cumulus
wget http://oss.cumulusnetworks.com/CumulusLinux-1.5.2.tar.gz
tar xvf CumulusLinux-1.5.2.tar.gz
# examine installation instructions
cat patches/README
@trapier
trapier / dons.sh
Created June 18, 2015 17:07
follow an interface with an ip address into its own namespace
#!/bin/bash
ns_name=$1
iface=$2
addr=$3
ip netns add ${ns_name}
ip a flush ${iface}
ip l s ${iface} down
ip l s ${iface} netns ${ns_name}
ip netns exec ${ns_name} /bin/bash -c "ip addr add ${addr} dev ${iface}"
ip netns exec ${ns_name} /bin/bash -c "ip l s ${iface} up"