A configuration job is a set of configuration commands that you can execute on one or more managed instances. When you execute the same configuration on multiple instances, you might want to use different values for the parameters used in your configuration. You can define variables that enable you to assign different values for these parameters or execute a job across multiple instances.
For example, consider a basic load balancing configuration where you add a load balancing virtual server, add two services, and bind the services to the virtual server. Now, you might want to have the same configuration on two instances but with different values for the virtual server and services names and IP addresses. You can use the configuration jobs feature to achieve this by using variables to define the names and IP addresses of the virtual server and services.
In this example, the following commands and variables are used:
add lb vserver servername HTTP ipaddress portnumber
add service servicename1 ipaddress1 HTTP 80
add service servicename2 ipaddress2 HTTP 80
bind lb vserver servername servicename1
bind lb vserver servername servicename2
To create a configuration job by defining variables in NetScaler MAS
1. Navigate to Networks > Configuration Jobs.
2. Click Add to create a job.
3. On the Create Job page, select the custom job parameters such as the name of the job, the instance type, and the configuration type.
4. In the Configuration Editor, type in the commands to add a load balancing virtual server, two services, and bind the services to the virtual server. Select the values that you want to convert to a variable, and then click Convert to Variable. For example, select the IP address of the load balancing server ipaddress, and click Convert to Variable as shown in the image below.
5. Once you see dollar signs enclose the variable’s value, click on the variable to further specify the details of the variable such as name, display name, and type. You can also click the Advanced option if you want to further specify a default value for your variable. Click Save and then, click Next.
Type in the rest of your commands and define all the variables.
6. You can review all the variables that you have defined while creating or editing a configuration job in a single consolidated view.
7. Do one of the following to view all the variables in a single consolidated view:
- While creating a configuration job, navigate to Networks > Configuration Jobs, select Create Job. On the Create Job page, you can review all the variables that you have added while creating the configuration job.
- While editing a configuration job, navigate to Network > Configuration Jobs, select the Job Name and click Edit. On the Configure Job page, you can review all the variables that were added while creating the configuration job.
8. You can then click on the Preview Variables tab to preview the variables in a single consolidated view that you have defined while creating or editing a configuration job.
9. A new pop-up window appears and displays all the parameters of variables such as Name, Display Name, Type, and default value in a tabular format. You can also edit and modify these parameters. Click the Done button after you have edited or modified any of the parameters.
10. You can then rearrange and reorder the commands in the configuration editor as appropriate. You can move the command from one line to another by dragging and dropping the command line. You can also move or rearrange the command line from one line to any target line by simply changing the command line number in the text box.
11. Select the instances you want to run the configuration job on.
12. In the Specify Variable Values tab, select the Variable Values from an Input File option and then click Download Input Key File. In our example, you will need to specify the server name on each instance, the IP addresses of the server and services, port numbers, and the service names. Save the file and upload it. If your values aren’t defined accurately, the system might throw an error.
13. The input key file is downloaded to your local system and you can edit it by specifying the variable values for each NetScaler instance you’ve selected previously and click Upload to upload the input key file to NetScaler MAS. Click Next. The input key file downloads to your local system and you can edit it by specifying the variable values for each NetScaler instance that you have selected previously.
Note: In the input key file, the variables are defined at three levels:
- Instance level
- Instance-group level
- Global level
Instance level variable values are applied on each instance, group level variable values are applied to all instances that are defined in the group, and global variables are variable values that are applied across all instances. NetScaler MAS gives first priority to instance level values. If there are no values provided to the variables for individual instances, NetScaler MAS uses the value provided at the group level. If there are no values provided at group level, NetScaler MAS uses the variable value provided at the global level. If you provide an input for a variable across all three levels, NetScaler MAS uses the instance level value as the default value.
14. Click Upload to upload the input key file to NetScaler MAS. Click Next.
15. You can also give common variable values across all instances and click Upload to upload the input key file to NetScaler MAS.
The key input files containing the variables values are persisted (with the same file name) in the configuration jobs. You can view and edit these input files that you have used and uploaded earlier while creating or editing the configuration jobs.
To view the executed configuration jobs while creating a configuration job, navigate to Network > Configuration Jobs, and click Create Job. In the Create Job page. On the Specify Variable Values tab, select the Common Variable Values for all Instances option to view the uploaded files. To edit the input files, download the input file and then edit and upload the files (keeping the same file name).
To view the already executed configuration jobs while editing a configuration job, navigate to Network > Configuration Jobs, select the Job Name and click Edit. In the Configure Job page, on the Specify Variable Values tab, select the Common Variable Values for all Instances option to view the uploaded files. To edit the input files, download the input file and then edit and upload the files (keeping the same file name).
16. On the Job Preview tab, you can evaluate and verify the commands to be run on each instance or instance group.
17. In the Execute tab, you can choose to execute your job now or schedule it to be executed at a later time. You can also choose what action NetScaler MAS should take if the command fails and if you’d like to send an Email notification regarding the success or failure of the job along with other details.
After configuring your jobs and executing it, you can see the job details by navigating to Networks > Configuration Jobs and select the job you just configured. Click on Details and then, click on Variable Details to see the list of variables added to your job.
The values that you have provided for the variables in step 5 are retained by NetScaler MAS when you save the job and exit, or when you schedule a job to be run at a later point of time.