Skip to content

Instantly share code, notes, and snippets.

@ezmobius
Created May 24, 2011 08:13
Show Gist options
  • Save ezmobius/988313 to your computer and use it in GitHub Desktop.
Save ezmobius/988313 to your computer and use it in GitHub Desktop.
# use fog to bootstrap a Rackspace cloud server
# since it does not have user-data like ec2
@compute = Fog::Compute.new(...)
server = @compute.servers.create(....)
server.wait_for { ready? }
server.private_key = IO.read("~/.ssh/foo")
server.public_key = IO.read("~/.ssh/foo.pub")
server.username = 'root'
server.setup :password => server.password
server.ssh ["echo '#{user_data}' > /root/bootstrap.sh",
"chmod +x /root/bootstrap.sh",
"/root/bootstrap.sh &"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment