Creating new virtual hosts using templates with scripting

Use scripting to create a new virtual host from a new or preexisting template.

Before you begin

Before starting this task, the wsadmin tool must be running. See the topic about starting the wsadmin scripting client using wsadmin scripting for more information.

About this task

Some configuration object types have templates that you can use when you create a virtual host. You can create a new virtual host using a preexisting template or by creating a new custom template. Perform the following steps to create a new virtual host using a template:

Procedure

  1. If you want to create a new custom template, perform the following steps:
    1. Copy and paste the following file into a new file, myvirtualhostname.xml:
      [AIX Solaris HP-UX Linux Windows][z/OS]
      app_server_root\config\templates\default\virtualhosts.xml
      [IBM i]
      app_server_root/config/templates/default/virtualhosts.xml
    2. Edit and customize the new myvirtualhostname.xml file.
    3. Place the new file in the following directory:
      [AIX Solaris HP-UX Linux Windows][z/OS]
      app_server_root\config\templates\custom\
      [IBM i]
      app_server_root/config/templates/custom/

    If you want the new custom template to appear with the list of templates, restart the deployment manager.

    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.

  2. 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)
  3. Create a new virtual host. 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)
  4. Save the configuration changes. See the topic about saving configuration changes with the wsadmin tool for more information.
  5. In a network deployment environment only, synchronize the node. See the topic about synchronizing nodes using the wsadmin scripting tool for more information.

주제 유형을 표시하는 아이콘 태스크 주제



시간소인 아이콘 마지막 업데이트 날짜: July 9, 2016 6:15
http://www14.software.ibm.com/webapp/wsbroker/redirect?version=cord&product=was-nd-mp&topic=txml_virtualhost
파일 이름:txml_virtualhost.html