Example script package to create a server
This script creates an application server on all of the custom nodes in a virtual system pattern or on the node part for which it is included.
The script package is intended to be used on either a deployment manager or stand-alone server part in a virtual system pattern. You specify the name of the application server.
Script variables
The following parameter
is include in this script package.
- SERVER_NAME:
- Specifies the name of the server to be created on each node. If multiple nodes exist in the virtual system pattern, the server name is augmented with a counter that begins at 1. This parameter is required.
cbscript.json example
[
{
"name": "Server creation",
"version": "1.0.0",
"description": "This script package creates a server on each node within the cell",
"command": "${WAS_PROFILE_ROOT}/bin/wsadmin.sh",
"log": "${WAS_PROFILE_ROOT}/logs/wsadmin.traceout",
"location": "/opt/tmp/createserver",
"timeout": "0",
"commandargs": "-lang jython -f /opt/tmp/createserver/create_server.jy $SERVER_NAME",
"type": "APPLICATION",
"keys":
[
{
"scriptkey": "SERVER_NAME",
"scriptvalue": ""
}
]
}
]
Example script
Note: This example script is
designed for version 7.0.0.x virtual system patterns only.
serverName = sys.argv[0]
managedNodeStr = AdminTask.listManagedNodes()
if len(managedNodeStr) != 0:
managedNodes = managedNodeStr.split("\n")
i=1
for managedNode in managedNodes:
thisServer = serverName + "_" + str(i)
AdminServerManagement.createApplicationServer(managedNode, thisServer, 'default')
i=i+1
else:
node = AdminControl.getNode()
AdminServerManagement.createApplicationServer(node, serverName, 'default')
AdminConfig.save()