Deployment Solution

 View Only

Using the Example DTK Scripts in Deployment Solution for Dell Servers 3+ 

Mar 13, 2008 03:33 PM

Deployment Solution for Dell Servers utilizes the Dell OpenManage Tookit, a set of drivers and command line utilities to configure Dell hardware. While the Job Builder, and predefined jobs use these utilities to automate some of the most common actions IT administrators perform on their Dell hardware, Deployment Solution for Dell Servers can be also used as a platform on which IT administrators can write their own custom DTK actions. This allows IT administrators to realize the full potential of the Dell servers by helping to streamline their management process.

Included with the "Basic Jobs" for Linux and WinPE created by the Configuration Wizard is a folder named "Dell Samples".

Inside this folder you will find a number of jobs that begin with "Sample:". The two jobs we will be addressing in this article, will be the sample DTK jobs:

Sample: Execute Dell Deployment Toolkit Tool
Sample: Execute Dell Deployment Toolkit Tool (template)

These jobs provide an easy entry point to the DTK tools. IT administrators armed with these sample scripts, and the DTK documentation (included with the DS for Dell install) can then write custom scripts, and immediately run them on many servers concurrently.

Section I: Using the DTK documentation

After installing Deployment Solution for Dell Servers, you'll notice a "Dell Help" menu entry available from the Tools menu in the Deployment Console:

The two items beginning with "Dell DTK" are documents provided by Dell. The Command Line Interface Reference explains the command line parameters, and their meanings for each of the individual tools provided by the DTK. The "Users Guide", primarily explains how to set up the DTK environment if you are building an preboot environment from scratch. Luckily, Deployment Solution for Dell Servers has already done this for you assuming you provided the necessary Linux and or WinPE preboot files during the installation. (Note: If you did not install the preboot environments, you may do so by running the configuration wizard at any time).

Open the Command Line Interface Reference Guide by clicking on Tools->Dell Help->Dell DTK - Command Line Interface Reference

This document contains sections explaining each of the major tools:

SYSCFG

  • Used for BIOS, Base Management Controller(BMC) and Dell Remote Access Card(DRAC) configuration.

RAIDCFG

  • Used for configuring RAID controller cards

UPINIT

  • Used for creating utility partitions (no real additional functionality is gained by interacting with this tool directly). For best results, create utility partitions using jobs created by the Job Builder.

RACADM

  • Used to configure DRACs. (similar to syscfg, except BIOS information is not included in the configuration).

Use these sections to write the proper calls in your custom script.

Hint: Before writing your custom script, see if the setting you are trying to adjust isn't already available in the firmware, DRAC or RAID configuration files. For example the switch "--bootseq" is listed in the configuration file as "bootseq=nic.emb.1,nic.emb.2,cdrom.emb.0,hdd.emb.0". You don't need to write a custom script to perform your action, you merely need to edit a captured configuration file, and use the jobs provided under folder "1.2 Configuration" to configure these settings out on your servers. If you only want to change one setting, create a configuration file with everything under the "do not edit information above this line" deleted, except the setting you want to change. That way you won't run the risk of altering any setting you are not interested in.

Once you've found the feature you want to use, and have determined it is not available in a configuration file, you're ready to proceed to the next section.

Section II: Writing the script

Example 1: Using the generic sample job for a simple DTK call.

For this example, let's write a script that runs in WinPE and does a hard reset of the DRAC card. This is useful if the DRAC card seems to have hung, or is otherwise not responding.

Note: There is a job "Sample: DRAC/IPMI action" that does this, but it contacts the DRAC card remotely through it's out-of-band interface, so if the card is completely unable to communicate over the LAN, this will not work. In this example we will create a script that will reset the card by interacting with the hardware directly while in an automation environment, thus bypassing the out-of-band interface.

Step 1: Make a copy of the "Sample: Execute Dell Deployment Toolkit Tool" job found in the WinPE Sample jobs, and rename that copy to "Reset DRAC card."

Step 2: Double click on the "Run Script" task within the job, to expose the script and scroll down to the user modification section. Read the information about the four available variables you can set.

Step 3: Set the variables in the User Modification Section:

set DDP_TOOL=rac5\racadm
set DDP_DEP_FILE=
set DDP_REDIRECT_OUT=TRUE
set OPTIONS=racreset

Step 4: Save the script, and run it.

After running the script I can go to the log in Dell\alogs, and find the following entry:

Q:\Dell\toolkit\WinPE\rac5\racadm.exe racreset 
RAC reset operation initiated successfully. It may take up to a minute for the RAC to come back online again.
rac5\racadm.exe returned 0 

This tells me the command line path it called, what racadm printed via standard out, and then gave me the return code. I can also consult the status detail of the script, and find the command line and return code.

"Sample: Execute Dell Deployment Toolkit Tool" is an easy way to execute a single DTK tool command, and to view it's output. You may now use this job as needed to reset misbehaving DRAC cards.

Example 2: Using the sample template job for a more sophisticated DTK call.

Let's expand the previous example and make our DTK tool call a little more powerful. For instance, suppose that simply reseting the DRAC doesn't do the trick, and this particular DRAC card still is inaccessible. We could write a script that will reset the card to its default values, and then configure the IP address to what it was before the job was run (as recorded in the database).

Step 1: Make a copy of the "Sample: Execute Dell Deployment Toolkit Tool (Template)" job found in the WinPE Dell Sample jobs, and rename that copy to "Recover defunct DRAC card."

Step 2: Double click on the "Run Script" task within the job, to expose the script. Since we are going to be doing some actual scripting, it might be easier to copy the entire script into notepad, that way we have more room to see the script.

Step 3: Look over the script, and notice that it has three modification sections. The reason this is called a "template" job, is because it acts much more like the jobs created by the job builder because it:

  1. Verifies that the tool is available
  2. Executes the command
  3. Retrieves the return code, and does processing of that return code.

With this finer granularity, we can add this additional functionality.

Step 4: Go to User Modification Section 1. This is the section where we check to make sure the tool is available. Remove the three "REM" statements after ":dtk1_found_lbl", and modify the statements to check for RACADM instead of SYSCFG as follows:

if exist %DELL_TK_TOOLS%\RAC5\racadm.exe goto dtk2_found_lbl
%ALOGEV% -c:%DFN_ERR_FILE% -l:%DFN_LVL_CRITICAL% -ss:"Error: File not found: %DELL_TK_TOOLS%\RAC5\racadm.exe"
goto exit_lbl

Step 5: Go to User Modification Section 2. This section is where we make the call to reset the configuration of the DRAC card clearing all previous settings. Modify the call as follows (following the syntax for racadm as found in the documentation):

%DELL_TK_TOOLS%\RAC5\racadm.exe racresetcfg >> %DFN_LOG_FILE%

The last portion of the line ">> %DFN_LOG_FILE%" appends the result to our log file.

Step 6: With the tool called, we now can process the return code. Go to User Modification Section 3 and you'll notice that this script exits if the return code is 0. We will modify this script to configure the DRAC's IP address if the return code was 0, and then exit. Otherwise we will exit after the first call.

Make a copy of User Modification Section 2 (plus the three lines that follow it and retrieve the return code), and place it below user modification 3. Rename this user modification section to be user modification section 4. This is where we will make our second call to racadm to configure the IP address.

Step 7: With a new user modification section in place, we need to modify user modification section 3, to jump to user modification section 5 instead of exiting. Modify the if statement as follows:

if "%RETURN_CODE%"=="0" goto usersection4

Then add a label:

:usersection4

To the beginning of User Modification Section 4.

Step 8: Edit the command line in user modification section 4 to be as follows:

%DELL_TK_TOOLS%\RAC5\racadm.exe config -g cfgLanNetworking -o cfgNicIpAddress %#*"select dracip from dbo.dell_power where computer_id=%ID%"%  >> %DFN_LOG_FILE%

Note: In the command line above you may not recognize %#*"select dracip from dbo.dell_power where computer_id=%ID%"%. This is a custom DS token that is replace with the IP address for the DRAC card as last recorded by the database when the script is run. The IP address will only exist in the database if you have enabled Power Control. See the Deployment Solution for Dell Servers documentation on how to use this feature.

Step 9: Now copy user modification section 3, to make a new user modification section 5. This will process the exit code from configuring the IP address.

You're done! Copy the task text back into the console (if you used notepad), and save the changes. This job can now be used to recover defunct DRAC cards if rebooting them doesn't work.

Feel free to use the skills you learned to create your own scripts. Remember to use the built in messaging, and logging to help you debug; it will make your life a lot easier.

There are also similar sample scripts for the Linux preboot environment which you can modify in similar ways. The only difference is that the scripts are written in the BASH scripting language. This is a very powerful scripting language, and there are many resources available on the web to help you learn this language.

Statistics
0 Favorited
0 Views
4 Files
0 Shares
0 Downloads
Attachment(s)
png file
dellsamples.png   4 KB   1 version
Uploaded - Feb 25, 2020
doc file
DTK_template.doc   97 KB   1 version
Uploaded - Feb 25, 2020
png file
menuoptions.png   9 KB   1 version
Uploaded - Feb 25, 2020
png file
statusdetail.png   6 KB   1 version
Uploaded - Feb 25, 2020

Tags and Keywords

Related Entries and Links

No Related Resource entered.