Skip to content

Instantly share code, notes, and snippets.

@smoser
smoser / test-image
Created Mar 13, 2014
test 2 different base images to compare behavior / performance
View test-image
#!/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'
View initial-setup
#!/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"
View 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=""
View upgrade-userdata.yaml
#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 Aug 29, 2015
maas deploy loop: deploy things in a loop collect logs and such
View README
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 Jul 13, 2015
loop reboot cloud image
View README
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 Aug 29, 2015
overlay example with maas ephemeral image
View run-overlay.sh
#!/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 Jul 31, 2015
hack-install cloud-init from source over the top of a install
View hack-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 Apr 4, 2011
userdata script for setting up freenx-server on ubuntu ec2
View freenx-userdata
#!/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
Add oneiric to cdimage
View 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