Last active
August 29, 2015 14:01
-
-
Save gionn/3343bd8c0e75e4a3aeb6 to your computer and use it in GitHub Desktop.
JClouds OpenStack entercloudsuite.com
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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