2010-01-11 13:38:07 +00:00

91 lines
4.8 KiB
XML

<!--
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-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" />
<taskdef name="sshexec" classname="org.apache.tools.ant.taskdefs.optional.ssh.SSHExec" classpathref="jclouds.classpath" />
<property name="jclouds.compute.url" value="compute://${jclouds.compute.account}:${jclouds.compute.key}@${jclouds.compute.provider}" />
<property name="jclouds.compute.servername" value="testforjcloud2" />
<target name="list" description="list the identity of all servers">
<compute action="list" provider="${jclouds.compute.url}" />
</target>
<target name="list-details" description="list the details of all servers">
<compute action="list-details" provider="${jclouds.compute.url}" />
</target>
<target name="destroy" description="destroy the server ${jclouds.compute.servername}">
<compute action="destroy" provider="${jclouds.compute.url}">
<server name="${jclouds.compute.servername}" />
</compute>
</target>
<target name="get" description="get the server ${jclouds.compute.servername}">
<compute action="get" provider="${jclouds.compute.url}">
<server name="${jclouds.compute.servername}" />
</compute>
</target>
<target name="create" description="create the server ${jclouds.compute.servername}">
<compute action="create" provider="${jclouds.compute.url}">
<server name="${jclouds.compute.servername}" image="UBUNTU_JEOS_90" profile="SMALLEST" hostproperty="host" usernameproperty="username" passwordproperty="password" />
</compute>
<property name="sudo" value="echo ${password}|sudo -S" />
<!-- funny game to get around sudo problems with >>. first sudo is only to prime the password -->
<sshexec host="${host}" username="${username}" password="${password}" trust="true"
command="${sudo} echo hello;echo nameserver 208.67.222.222 |sudo tee -a /etc/resolv.conf" />
<sshexec host="${host}" username="${username}" password="${password}" trust="true"
command="${sudo} apt-get update -qq" />
<sshexec host="${host}" username="${username}" password="${password}" trust="true"
command="${sudo} apt-get upgrade -y -qq" />
<sshexec host="${host}" username="${username}" password="${password}" trust="true"
command="${sudo} apt-get install -y -qq wget" />
<sshexec host="${host}" username="${username}" password="${password}" trust="true"
command="${sudo} apt-get install -y -qq openjdk-6-jdk" />
<sshexec host="${host}" username="${username}" password="${password}" trust="true"
command="wget -q http://www.alliedquotes.com/mirrors/apache/tomcat/tomcat-6/v6.0.20/bin/apache-tomcat-6.0.20.tar.gz" />
<sshexec host="${host}" username="${username}" password="${password}" trust="true"
command="tar xzf apache-tomcat-6.0.20.tar.gz" />
<sshexec host="${host}" username="${username}" password="${password}" trust="true"
command="${sudo} mv apache-tomcat-6.0.20 /usr/local/tomcat" />
</target>
</project>