Example: Creating new virtual hosts using a template
Some configuration object types have templates that you can use when you create a virtual host.
- Create a new virtual host template virtualhostname.xml in the following directory:
<WAS-ROOT>\config\templates\custom\
- Copy and paste the following file into the new virtual host template:
<WAS-ROOT>\config\templates\default\virtualhosts.xml
- Edit and customize the new virtualhostname.xml file.
- Use the reset command to recognize new templates, for example:
Using Jacl:
$AdminConfig reset
Using Jython:
AdminConfig.reset()
- Use the AdminConfig object listTemplates command to list available templates, for example:
Using Jacl:
$AdminConfig listTemplates VirtualHost
Using Jython:
print AdminConfig.listTemplates('VirtualHost')Example output:
default_host(templates/default:virtualhosts.xml#VirtualHost_1) my_host(templates/custom:virtualhostname.xml#VirtualHost_1)Note: To list the new templates, restart DeploymentManager or use the AdminConfig object reset command.
- Create a new virtual host using the custom template, for example:
Using Jacl:
set cell [$AdminConfig getid /Cell:NetworkDeploymentCell/] set vtempl [$AdminConfig listTemplates VirtualHost my_host] $AdminConfig createUsingTemplate VirtualHost $cell {{name newVirHost}} $vtempl
Using Jython:
cell = AdminConfig.getid('/Cell:NetworkDeploymentCell/') vtempl = AdminConfig.listTemplates('VirtualHost', 'my_host') AdminConfig.createUsingTemplate('VirtualHost', cell, [['name', 'newVirHost']], vtempl)
- Save the changes with the following command:
Using Jacl:
$AdminConfig save
Using Jython:
AdminConfig.save()
Note: The administrative console does not support the use of custom templates. The new template that you create will not be visible in the administrative console panels.