jclouds/tools/antcontrib/samples/compute/build.xml

110 lines
4.1 KiB
XML
Raw Normal View History

<!--
Copyright (C) 2009 Cloud Conscious, LLC. <info@cloudconscious.com>
====================================================================
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
====================================================================
-->
<project name="compute" default="list" basedir="." xmlns:artifact="urn:maven-artifact-ant">
<mkdir dir="build" />
<!--
<get src="http://apache.imghat.com/maven/binaries/maven-ant-tasks-2.1.0.jar" dest="build/maven-ant-tasks-2.1.0.jar"/>
-->
<path id="maven-ant-tasks.classpath" path="build/maven-ant-tasks-2.1.0.jar" />
<typedef resource="org/apache/maven/artifact/ant/antlib.xml" uri="urn:maven-artifact-ant" classpathref="maven-ant-tasks.classpath" />
<artifact:localRepository id="local.repository" path="${user.home}/.m2/repository" />
<artifact:remoteRepository id="jclouds-snapshot.repository" url="http://jclouds.rimuhosting.com/maven2/snapshots" />
<artifact:dependencies pathId="jclouds.classpath">
<dependency groupId="org.jclouds" artifactId="jclouds-antcontrib" version="1.0-SNAPSHOT" />
<dependency groupId="org.jclouds" artifactId="jclouds-hostingdotcom" version="1.0-SNAPSHOT" />
<dependency groupId="org.jclouds" artifactId="jclouds-rimuhosting" version="1.0-SNAPSHOT" />
<dependency groupId="org.jclouds" artifactId="jclouds-aws" version="1.0-SNAPSHOT" />
<dependency groupId="org.jclouds" artifactId="jclouds-terremark" version="1.0-SNAPSHOT" />
<localRepository refid="local.repository" />
<remoteRepository refid="jclouds-snapshot.repository" />
</artifact:dependencies>
<typedef name="compute" classname="org.jclouds.tools.ant.taskdefs.compute.ComputeTask" classpathref="jclouds.classpath" />
<input
message="Which service would you like to use (ec2, terremark, rimuhosting, hostingdotcom)?"
validargs="ec2,terremark,rimuhosting,hostingdotcom"
addproperty="service"
/>
<input
message="What is your account on ${service}?"
addproperty="account"
/>
<input
message="What is the key for ${account}?"
addproperty="key"
/>
<property name="jclouds.compute.url" value="compute://${account}:${key}@${service}" />
<target name="list" description="list the identity of all nodes">
<compute action="list" provider="${jclouds.compute.url}" />
</target>
<target name="list-details" description="list the details of all nodes">
<compute action="list-details" provider="${jclouds.compute.url}" />
</target>
<target name="destroy" description="destroy the node ${nodename}">
<input
message="Which node do you wish to destroy"
addproperty="nodename"
/>
<compute action="destroy" provider="${jclouds.compute.url}">
<node name="${nodename}" />
</compute>
</target>
<target name="get" description="get the node ${nodename}">
<input
message="Which node do you wish to describe?"
addproperty="nodename"
/>
<compute action="get" provider="${jclouds.compute.url}">
<node name="${nodename}" />
</compute>
</target>
<property name="location" value="default" />
<target name="create" description="create the node ${nodename}">
<property name="os" value="UBUNTU" />
<input
message="What do you want to name your node?"
addproperty="nodename"
/>
<compute action="create" provider="${jclouds.compute.url}">
<node name="${nodename}" location="${location}" os="${os}" size="SMALLEST" hostproperty="host" usernameproperty="username" passwordproperty="password" />
</compute>
</target>
</project>