{{:Design Warning}}
xCAT has supported the running of postscripts and postbootscripts for deployment of Linux node. This design is focus on how to support the running of postscripts and postbootscripts during deployment of Windows compute nodes.
The basic functionalities:
The mypostscript.tmpl is a template which is used to create the mypostscript script which includes environment variables and postscripts to run in compute node. The default path of it is /opt/xcat/share/xcat/templates/mypostscript/mypostscript.tmpl. If you want to customize it, copy it to /install/postscripts/mypostscript.tmpl and customize it with the rules in how to use mypostscript.tmpl (sourceforge.net).
The scripts can be any file which can be run in Windows OS.
Since Windows OS recognizes the file type by the postfix, all the postscripts which are created for Windows compute node should have correct postfix like .bat, .cmd, .vbs, .ps1
When running of postscripts, the running log will be written to c:\xcatpost\xcat.log. Admin can check the log at anytime for checking and debugging.
On the xCAT management node, copy the postscripts/postbootscripts to /install/winpostscripts. If there are files which will be called by your scripts, also copy them to /install/winpostscripts
cp <scripts> /install/winpostscripts
Note: the scripts which are set by postscripts.xcatdefaults will be ignored.
chdef <node> postscript="xx arg1 arg2,yy" postbootscripts="aa,bb arg1"
chdef -t osoimage <osimage name> postscript=xx,yy postbootscripts=aa,bb
In the first pass support, the precreatemypostscripts must be enabled. That means for any changes in postscript/postscripts attributes or mypostscript.tmpl, the nodeset command must be run to refresh the mypostscript.
chdef -t site clustersite precreatemypostscripts=1
4. Run the OS deployment
nodeset <node> osimage=<osimage name>
rpower
In existed code logic, there is a install/autoinst/<node>.cmd file which is used to initiate the OS deployment. Following piece of code will be added in <node>.cmd to copy the files.
If existed mypostscript.<node> in MN:/install/mypostscript
copy MN:/install/mypostscript/mypostscript.<node> c:\xcatpost\
oppy MN:/install/winpostscripts/* c:\xcatpost\
Else
Do nothing
End if
Create a script named 'xcatwinpost.vbs' which will be used to initiate the postscript mechanism. Create a script named 'runpost.vbs' which will be used to run postscript and log debug messages.
Both of the scripts will be installed at /install/winpostscripts/ on xCAT MN and SN by xCAT rpm. Them will be copied to compute node by section: Copy postscripts needed stuffs to compute node
xcatwinpost.vbs will parse the mypostscript.<node> and generate the mypostscript.cmd for postscripts running and mypostbootscript.cmd for postbootscripts running.
Inject the xcatwinpost.vbs in unattend.xml so that it can be called during node deployment by Windows setup program
Add a section like following in /install/autoinst/<node>.xml when run nodeset command:
<RunSynchronous>
<RunSynchronousCommand wcm:action="add">
<Description>StartPointOfPostscripts</Description>
<Order>50</Order>
<Path>c:\xcatpost\winpostscripts\xcatwinpost.vbs</Path>
<WillReboot>OnRequest</WillReboot>
</RunSynchronousCommand>
</RunSynchronous>
Use /install/autoinst/<node>.cmd to create a file named C:\Windows\Setup\Scripts\SetupComplete.cmd on Windows compute node. This is a Windows specific file which is called automatically at the first boot.
Add the file 'mypostbootscript.cmd' which is created by 'xcatwinpost.vbs' into the C:\Windows\Setup\Scripts\SetupComplete.cmd to initiate the running of postbootscripts.