The example provided in this section is a general purpose job that only provisions a resource.
You might use a job like this, for example, each day at 5:00 p.m. when your accounting department requires extra SAP servers to be available. As a developer, you would create a job that provisions the required VMs, then use the Orchestrator Scheduler to schedule the job to run every day at the time specified.
In this example, the provision job retrieves the members of a resource group (which are VMs) and invokes the provision action on the VM objects.
To setup to create the provision.job, use the following procedure:
Create your VMs and follow the discovery process in the Orchestrator console so the VMs are in the Orchestrator inventory.
In Orchestrator console, create a Resource Group called sap and add the required VMs as members of the group.
Given the .jdl and .policy below you would create a .job file (jar them):
>jar cvf provision.job provision.jdl provision.policy
Deploy the provision.job file to the Orchestrator Server using either the Orchestrator console or the zosadmin command line.
To run the job, use either of the following procedures:
At the command line, enter:
>zos login <zos server> >zos run provision VmGroup="sap"
For more complete details about entering CLI commands, see Novell ZENworks Orchestrator 1.2 Job Management Guide.
Fill in the job name (provision), user, priority.
For the jobarg VmGroup, enter sap.
Create a Trigger for the time you want this job to run.
Save the Schedule and enable it by clicking.
You can manually force scheduling by clicking.
For more complete details about using the ZOS Control Scheduler. See also Section 9.5, Automatically Provisioning a VM Server.
"""Job that retrieves the members of a supplied resource group and invokes the provision action on all members. For more details about this class, see Job. See also ProvisionSpec. The members must be VMs. """ class provision(Job): def job_started_event(self): # Retrieves the value of a job argument supplied in # the 'zos run' or scheduled run. VmGroup = self.getFact("jobargs.VmGroup") # # Retrieves the resource group grid object of the supplied name. # The job Fails if the group name does not exist. # group = getMatrix().getGroup(TYPE_RESOURCE,VmGroup) if group == None: self.fail("No such group '%s'." % (VmGroup)) # # Gets a list of group members and invokes a provision action on each one. # members = group.getMembers() for vm in members: vm.provision() print "Provision action requested for VM '%s'" % (vm.getFact("resource.id")) Job Policy: <!-- The policy definition for the provision example job. This specifies the job argument VmGroup' which is required --> <policy> <jobargs> <fact name="VmGroup" type="String" description="Name of a VM resource group whose members will be provisioned" /> </jobargs> </policy>