VMware

This Question is Not Answered

1 "correct" answer available (10 pts) 2 "helpful" answers available (6 pts)
2 Replies Last post: Jul 13, 2009 2:49 AM by CapiZikus  

Script to Clone Configuration and Deploys in LM posted: Jul 10, 2009 8:04 AM

Click to view CapiZikus's profile Enthusiast 112 posts since
May 21, 2009

Is anyway I could create a script to clone a config that shared in LM and deploys them afterward?
I know how to do clone and deploy script using VI Toolkit, but not sure about the LM, any suggest or starting poing please.

Thanks

Click to view Michael Ottati's profile Hot Shot 93 posts since
Jan 6, 2006
The API is relatively straight forward although nearly everyone has encapsulated it in some other language. At our location we chose to encapsulate the API within Java/Ant. The code we used is open sourced and hosted out at http://www.labminder.org/. If you were to use that package, the scripting would look something like the script below.

The included is script is a cut an past job from a couple of files so apologies if I missed something. This particular script

  • checks out a library configuration into a workspace
  • deploys it
  • installs software
  • shuts down the workspace.
  • publishes the configuration as a library
  • purges the workspace

This is pretty typical of much of our automation workflow.


If you have additional questions, you can contact me privately.

 
<?xml version="1.0" encoding="UTF-8" ?>

<project name="StandAlone"
	xmlns:LabMinder="antlib:org.labminder.ant.tasks" default="main">
	
	<!-- Take the properties also from the ContentServer area -->
	<property file="RemoteInstaller/build.properties"/>	
	
	
	<property name="sourceConfig" value="${ant.project.name} Base"/>
    <property name="destinationConfig" value="${ant.project.name}.${build.number}"/>
	<property name="publishConfig" value="${ant.project.name} ${documentum.majorversion}.${documentum.minorversion}.${contentserver.buildnumber}"/>
	<import file="common.xml"/>
		
		<target name="main">
			<!-- Call the ssh target once for each machine you want to install something on -->
			
			<antcall target="checkout"/>
			
			<!-- Expose the configuration properties so than can be passed back in the SSH invocation -->
			<LabMinder:ConfigurationInfo
                username="${labmgr.user}"
                password="${labmgr.password}"
                host="${labmgr.host}"
                sourceConfig="${destinationConfig}"
                configPrefix="Configuration"/>
			
			<!-- Primary Content Server Installation -->
			<antcall target="ssh">
				<param name="ssh.external-ip-address" value="${Configuration.ContentServer.external-ip-address}"/>
				<param name="ssh.p4client" value="${p4.contentserver.client}"/>
				<param name="ssh.buildtarget" value="install"/>
			</antcall>
			
			<antcall target="publish"/>
		
		</target>
		
    <target name="checkout"
            description="Checks out the configuration">
        <LabMinder:Checkout username="${labmgr.user}"
                    password="${labmgr.password}"
                    host="${labmgr.host}"
                    sourceConfig="${sourceConfig}"
                    destinationConfig="${destinationConfig}"
                />

        <LabMinder:Deploy username="${labmgr.user}"
                  password="${labmgr.password}"
                  host="${labmgr.host}"
                  sourceConfig="${destinationConfig}"/>
		
    </target>

	<target name="publish" depends="configinfo" >
        <LabMinder:ShutdownConfiguration username="${labmgr.user}"
                                 password="${labmgr.password}"
                                 host="${labmgr.host}"
                                 sourceConfig="${destinationConfig}"
								 powerofftimeout="300"
                />
        
        <LabMinder:Capture username="${labmgr.user}"
                    password="${labmgr.password}"
                    host="${labmgr.host}"
                    sourceConfig="${destinationConfig}"
                    destinationConfig="${publishConfig}"
                    public="true"
                />

        <antcall target="undeployAndDelete"/>

    </target>

    <target name="configinfo">
        <LabMinder:ConfigurationInfo
                username="${labmgr.user}"
                password="${labmgr.password}"
                host="${labmgr.host}"
                sourceConfig="${destinationConfig}"
                configPrefix="Configuration"/>
    </target>


    <target name="undeployAndDelete"

            description="Tests Undeploy">
        <LabMinder:Undeploy username="${labmgr.user}"
                    password="${labmgr.password}"
                    host="${labmgr.host}"
                    sourceConfig="${destinationConfig}"
                    delete="true"
                />
    </target>
	

</project>

Developer Social Media

Communities