How to change domain configuration in WLST offline

Scripted installation and configuration of weblogic clusters is actually quite easy. My normal approach is to create some configuration templates using the GUI wizard and then pack the resulting domains into template files.

The using WLST I can change the settings of the domain template to fit the environment I'm currently installing.

To do a scripted domain configuration, do the following steps:
  1. Create a domain template that is close the environment you want to build in the WebLogic Configuration Wizard.
    # $MIDDLEWARE_HOME/wlserver_10.3/common/bin/config.sh
  2. Create the domain template file using the WebLogic pack script.
    # $MIDDLEWARE_HOME/wlserver_10.3/common/bin/pack.sh -domain=[DOMAIN_HOME] -template=[Resulting template jar file] - template_name=[Name of template]
  3. Create WLST script to change the template.
    # emacs domain_script.py
  4. A simple WLST script is shown below and can be used as a starting point for creating your own scripts:
    readTemplate("[template.jar file]")
    cd('/Servers/AdminServer')
    set('ListenAddress', '')
    set('ListenPort','7001')
    setOption('OverwriteDomain','true')
    writeDomain('[DOMAIN_HOME]')
    closeTemplate()
    exit()
  5. Execute the script using the WebLogic wlst interpreter.
    # . $MIDDLEWARE_HOME/wlserver_10.3/server/bin/setWLSEnv.sh
    # java weblogic.WLST domain_script.py
This should result in you having a domain folder written to the path you specified as DOMAIN_HOME in the WLST script writeDomain command.
In future posts I will give small examples of things you can do in WLST to change behavior of the domain. This post will serve as the starting point of those future posts.