jclouds/antcontrib/samples/compute/build.xml

184 lines
6.8 KiB
XML
Raw Normal View History

2010-09-27 05:11:58 -04:00
<!--
Licensed to jclouds, Inc. (jclouds) under one or more
contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. jclouds licenses this file
to you 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.
2010-09-27 05:11:58 -04:00
-->
<project name="compute" default="dump" basedir="." xmlns:artifact="urn:maven-artifact-ant">
<property file="build.properties" />
2011-02-15 06:05:47 -05:00
<property name="jclouds.version" value="1.0-beta-9a" />
2010-09-27 05:11:58 -04:00
<property name="privatekeyfile" value="${user.home}/.ssh/id_rsa" />
<property name="publickeyfile" value="${user.home}/.ssh/id_rsa.pub" />
<mkdir dir="build" />
<get src="http://opensource.become.com/apache//maven/binaries/maven-ant-tasks-2.1.1.jar" dest="build/maven-ant-tasks.jar"/>
<input
2011-02-15 06:05:47 -05:00
message="Which provider would you like to use (aws-ec2, bluelock-vcdirector, cloudservers-uk, cloudservers-us, cloudsigma-zrh, eucalyptus-partnercloud-ec2, elastichosts-lon-b, elastichosts-lon-p, elastichosts-sat-p, gogrid, openhosting-east1, serverlove-z1-man, skalicloud-sdg-my, slicehost, trmk-ecloud, trmk-vcloudexpress)?"
validargs="aws-ec2,bluelock-vcdirector,cloudservers-uk,cloudservers-us,cloudsigma-zrh,eucalyptus-partnercloud-ec2,elastichosts-lon-b,elastichosts-lon-p,elastichosts-sat-p,gogrid,openhosting-east1,serverlove-z1-man,skalicloud-sdg-my,slicehost,trmk-ecloud,trmk-vcloudexpress"
2010-09-27 05:11:58 -04:00
addproperty="provider"
/>
<path id="maven-ant-tasks.classpath" path="build/maven-ant-tasks.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="https://oss.sonatype.org/content/repositories/snapshots" />
<artifact:dependencies pathId="jclouds.classpath">
<dependency groupId="org.jclouds" artifactId="jclouds-antcontrib" version="${jclouds.version}" />
2011-02-15 06:05:47 -05:00
<dependency groupId="org.jclouds.provider" artifactId="${provider}" version="${jclouds.version}" />
2010-09-27 05:11:58 -04:00
<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="What is your identity on ${provider}?"
addproperty="identity"
/>
<input
message="What is the credential for ${identity}?"
addproperty="credential"
/>
<property name="jclouds.compute.url" value="compute://${identity}:${credential}@${provider}" />
<target name="list" description="list the identity of all nodes">
<compute actions="list" provider="${jclouds.compute.url}" />
</target>
<target name="list-details" description="list the details of all nodes">
<compute actions="list-details" provider="${jclouds.compute.url}" />
</target>
<target name="list-images" description="list the images supported">
<compute actions="list-images" provider="${jclouds.compute.url}" />
</target>
<target name="list-hardwares" description="list the hardwares supported">
<compute actions="list-sizes" provider="${jclouds.compute.url}" />
2010-09-27 05:11:58 -04:00
</target>
<target name="list-locations" description="list the locations supported">
<compute actions="list-locations" provider="${jclouds.compute.url}" />
</target>
<target name="dump" description="list all information we can obtain about the cloud">
<compute actions="list-locations,list-sizes,list-images,list-details" provider="${jclouds.compute.url}" />
2010-09-27 05:11:58 -04:00
</target>
2011-02-15 06:05:47 -05:00
<target name="reboot" depends="reboot-id,reboot-group" />
2010-09-27 05:11:58 -04:00
2011-02-15 06:05:47 -05:00
<target name="reboot-id" description="reboot the node ${id}" unless="group">
2010-09-27 05:11:58 -04:00
<input
message="Which node do you wish to reboot"
addproperty="id"
/>
<compute actions="reboot" provider="${jclouds.compute.url}">
<nodes id="${id}" />
</compute>
</target>
2011-02-15 06:05:47 -05:00
<target name="reboot-group" description="reboot the nodes with group ${group}" unless="id" >
2010-09-27 05:11:58 -04:00
<input
2011-02-15 06:05:47 -05:00
message="Which group do you wish to reboot"
addproperty="group"
2010-09-27 05:11:58 -04:00
/>
<compute actions="reboot" provider="${jclouds.compute.url}">
2011-02-15 06:05:47 -05:00
<nodes group="${group}" />
2010-09-27 05:11:58 -04:00
</compute>
</target>
2011-02-15 06:05:47 -05:00
<target name="destroy" depends="destroy-id,destroy-group" />
2010-09-27 05:11:58 -04:00
2011-02-15 06:05:47 -05:00
<target name="destroy-id" description="destroy the node ${id}" unless="group">
2010-09-27 05:11:58 -04:00
<input
message="Which node do you wish to destroy"
addproperty="id"
/>
<compute actions="destroy" provider="${jclouds.compute.url}">
<nodes id="${id}" />
</compute>
</target>
2011-02-15 06:05:47 -05:00
<target name="destroy-group" description="destroy the nodes with group ${group}" unless="id" >
2010-09-27 05:11:58 -04:00
<input
2011-02-15 06:05:47 -05:00
message="Which group do you wish to destroy"
addproperty="group"
2010-09-27 05:11:58 -04:00
/>
<compute actions="destroy" provider="${jclouds.compute.url}">
2011-02-15 06:05:47 -05:00
<nodes group="${group}" />
2010-09-27 05:11:58 -04:00
</compute>
</target>
2011-02-15 06:05:47 -05:00
<target name="get" depends="get-group,get-id" />
2010-09-27 05:11:58 -04:00
2011-02-15 06:05:47 -05:00
<target name="get-id" description="get the node ${id}" unless="group">
2010-09-27 05:11:58 -04:00
<input
message="Which node do you wish to get"
addproperty="id"
/>
<compute actions="get" provider="${jclouds.compute.url}">
<nodes id="${id}" />
</compute>
</target>
2011-02-15 06:05:47 -05:00
<target name="get-group" description="get the nodes with group ${group}" unless="id" >
2010-09-27 05:11:58 -04:00
<input
2011-02-15 06:05:47 -05:00
message="Which group do you wish to get"
addproperty="group"
2010-09-27 05:11:58 -04:00
/>
<compute actions="get" provider="${jclouds.compute.url}">
2011-02-15 06:05:47 -05:00
<nodes group="${group}" />
2010-09-27 05:11:58 -04:00
</compute>
</target>
<property name="location" value="" />
2011-02-15 06:05:47 -05:00
<target name="create" description="create the node ${group}">
2010-09-27 05:11:58 -04:00
<property name="privatekeyfile" value="${user.home}/.ssh/id_rsa" />
<property name="publickeyfile" value="${user.home}/.ssh/id_rsa.pub" />
<property name="os" value="UBUNTU" />
<property name="count" value="1" />
<input
2011-02-15 06:05:47 -05:00
message="What do you want to group your nodes with?"
addproperty="group"
2010-09-27 05:11:58 -04:00
/>
<compute actions="create" provider="${jclouds.compute.url}">
2011-02-15 06:05:47 -05:00
<nodes privatekeyfile="${privatekeyfile}" publickeyfile="${publickeyfile}" group="${group}" count="${count}" os="${os}" hardware="SMALLEST" hostproperty="host" usernameproperty="username" passwordproperty="password" />
2010-09-27 05:11:58 -04:00
</compute>
</target>
2011-02-15 06:05:47 -05:00
</project>