Skip to content

Instantly share code, notes, and snippets.

@gionn
Last active August 29, 2015 14:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gionn/3343bd8c0e75e4a3aeb6 to your computer and use it in GitHub Desktop.
Save gionn/3343bd8c0e75e4a3aeb6 to your computer and use it in GitHub Desktop.
JClouds OpenStack entercloudsuite.com
ComputeServiceContext context = ContextBuilder.newBuilder("openstack-nova")
.credentials(user, password)
.endpoint("https://api-legacy.entercloudsuite.com:5000/v2.0")
.modules(ImmutableSet.<Module> of(new SLF4JLoggingModule(),
new SshjSshClientModule()))
.buildView(ComputeServiceContext.class);
ComputeService computeService = context.getComputeService();
Template template = computeService.getTemplateBuilder()
.osFamily(OsFamily.UBUNTU).osVersionMatches(".*12.04.*").os64Bit(true)
.imageNameMatches(".*?Precise Pangolin x64$")
.minCores(1).minRam(1024)
.options(inboundPorts(22, 80))
.build();
Set<? extends NodeMetadata> nodes = computeService.createNodesInGroup("groupName", 1, template);
for (NodeMetadata nodeMetadata : nodes)
{
nodeMetadata.getPrivateAddresses();
nodeMetadata.getPublicAddresses();
nodeMetadata.getCredentials();
computeService.runScriptOnNode(nodeMetadata.getId(), "curl https://server/provisioning.sh | bash");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment