Skip to content

Instantly share code, notes, and snippets.

@mahemoff
Created January 3, 2012 14:26
Show Gist options
  • Save mahemoff/1555084 to your computer and use it in GitHub Desktop.
Save mahemoff/1555084 to your computer and use it in GitHub Desktop.
Ruby Linode API
# See https://github.com/rick/linode
### CREATE STACKSCRIPT
require 'linode'
s = Linode::Stackscript.new :api_key => 'linode-key-which-you-can-request-from-your-account'
s.create :label => 'amazingbox', :distributionIDList => '64', :script => '#!/bin/bash\nls -latr'
# '64' happens to be the distro for Ubuntu 10.04 LTS.
# Find distribution IDs with Linode.new.avail.distributions.
### UPDATE STACKSCRIPT
s.update :stackScriptID => (s.list.select { |s| s.label=='amazingbox' }.first.stackscriptid), :script => '#!/bin/bash ; echo "this build is even better" ; ls -lasr'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment