Skip to content

Instantly share code, notes, and snippets.

@whytheplatypus
Created February 1, 2013 17:22
Show Gist options
  • Save whytheplatypus/4692705 to your computer and use it in GitHub Desktop.
Save whytheplatypus/4692705 to your computer and use it in GitHub Desktop.
Create a new vm in smartos (I have the brand coded to joyent so it's really only for smartos builds I guess) first argument should be the UUID of the image second is the desired hostname for the new vm and the third is an alias for it.
#!/bin/bash
export GATEWAY=$(netstat -r | grep default | awk '{ print $2 }')
echo "{
\"brand\": \"joyent\",
\"dataset_uuid\": \"$1\",
\"hostname\": \"$2\",
\"alias\": \"$3\",
\"nics\": [
{
\"nic_tag\": \"admin\",
\"ip\": \"dhcp\",
\"netmask\": \"255.255.255.0\",
\"gateway\":\"${GATEWAY}\"
}
]
}" | vmadm create
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment