Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@smoser
smoser / test-image
Created March 13, 2014 20:18
test 2 different base images to compare behavior / performance
#!/bin/bash
## images were created with something like this:
## mv trusty-server-cloudimg-amd64-disk1.img img.dist
## qemu-img convert -O raw img.dist disk-patched.img
## qemu-img convert -O raw img.dist disk-unpatched.img
## sudo mount-image-callback -v disk-patched.img -- \
## sh -c 'cp debs/* $MOUNTPOINT/tmp &&
## LANG=C chroot $MOUNTPOINT sh -c "dpkg -i /tmp/*.deb" &&
## rm $MOUNTPOINT/tmp/*.deb'
#!/bin/sh
##
## this is run on new cloudatcost.com system, to get me more set up
## disables root password login and adds my user.
##
bdimage="http://bazaar.launchpad.net/~smoser/+junk/backdoor-image/download/head:/backdoorimage-20121004180823-pi43gdnl3fbp82la-1/backdoor-image"
me_ssh_id="smoser"
gecos="Scott Moser"
user="smoser"
@smoser
smoser / mini-ec2-init
Created September 24, 2014 20:59
mini ec2 init
#!/bin/bash
set -f
NAME="mini-ec2-init"
OIFS="$IFS"
CONSOLE="/dev/console"
LOG="/var/log/${NAME}.log"
MD_URL="http://169.254.169.254/2009-04-04/"
VERBOSITY=${VERBOSITY:-0}
HAS_USERDATA=""
@smoser
smoser / upgrade-userdata.yaml
Created May 14, 2015 19:40
example user-data
#cloud-config
apt_upgrade: true
packages: [ bzr, vim-nox, git-core ]
apt_reboot_if_required: true
ssh_import_id: [smoser]
@smoser
smoser / README
Last active August 29, 2015 14:23
maas deploy loop: deploy things in a loop collect logs and such
this is hacked together code that i wanted to save.
When testing deployment on ppc64 of maas, I put it together to collect logs and run.
user-data:
the user-data that is preprocessed (replaces LAUNCH_SECONDS) and fed to maas-deploy-node. it contains the string to look for for successful run.
deploy-run: the primary runner script.
Running:
* run tmux, name your session 'deploy-run'
@smoser
smoser / README
Created July 13, 2015 19:56
loop reboot cloud image
this is just some hacky user-datas that I put together to try to catch failure as in bug 1473527 (http://pad.lv/1473527) . Doing it helped me see ppc64el image bug 1474090 (http://pad.lv/1474090)
very un-finished.
things here:
a.) reboot-loop-userdata.txt
this reboots in a loop up to NUM_BOOTS times
youneed to replace NUM_BOOTS
@smoser
smoser / run-overlay.sh
Last active August 29, 2015 14:26
overlay example with maas ephemeral image
#!/bin/bash
# maas ephemeral wily image in root-image
# given the following:
# root-image: wily maas ephemeral image in root-image from [1] (uncompressed)
# boot-kernel: wily/generic/boot-kernel
# boot-initrd: wily/generic/boot-initrd
#
# --
# [1] http://maas.ubuntu.com/images/ephemeral-v2/daily/wily/amd64/20150728.1/
@smoser
smoser / hack-install
Created July 31, 2015 14:46
hack-install cloud-init from source over the top of a install
#!/bin/sh
# this just hacks the current directory (cloud-init source) over the top
# of a install'd deb version
target_d=""
src_d="$PWD"
python="/usr/bin/python3"
error() { echo "$@" 1>&2; }
fail() { [ $# -eq 0 ] || error "$@"; exit 1; }
ref="cloudinit/cloud.py"
@smoser
smoser / freenx-userdata
Created April 4, 2011 20:42
userdata script for setting up freenx-server on ubuntu ec2
#!/bin/sh
# us-east-1 ami-42916c2b canonical ebs/ubuntu-natty-daily-i386-desktop-20110327
# ec2-run-instances --instance-type t1.micro --user-data-file /home/smoser/t/nx-setup.ud ami-42916c2b
{
set -x
iusername="nxtest"
ipasswd="foo.bar-NX"
lp_auth="smoser" # auth the user '${lp_auth}' to 'ubuntu' with ssh-import-id
[ -z "${lp_auth}" ] || sudo -Hu ubuntu ssh-import-id ${lp_auth}
@smoser
smoser / oneiric-to-cdimage
Created May 2, 2011 16:16
Add oneiric to cdimage
------------------------------------------------------------
revno: 1037
committer: Stephen Scott Moser <smoser@nectarine>
branch nick: cdimage
timestamp: Mon 2011-05-02 15:46:25 +0000
message:
add knowledge of 'oneiric', the 'Oneiric Ocelot'
diff:
=== modified file 'bin/make-web-indices'
--- bin/make-web-indices 2011-04-27 20:50:21 +0000