Configuring Citrix Netscaler using SSH from a remote computer


Want to configure a Netscaler by means of SSH and BASH scripting from a remote (linux) computer?

Citrix wrote an article about this

It is great for a starting point. In this article they run commands against the BASH shell on a Netscaler.I don’t wan’t to run commands against the BASH shell, but directly to the Netscaler CLI. (so i can config the netscaler remotely)

Also, i don’t want to put Netscaler CLI config code in one ‘command line’ as the docs describes.
I wan’t to build a full blown script for configuring a Netscaler which will contain multiple lines of code.

Here’s a BASH script body:

echo “Netscaler VPX (Instance) configuration”
ssh -T nsroot@ << EOF > log.txt
add ns trafficDomain 67 -aliasName 67
add ns trafficDomain 88 -aliasName 88

Place this code in a BASH script and place proper right on the file be using the CHMOD command. This script will execute commands in RED against the Netscaler, not BASH, CLI. It will redirect output to a log.txt file in the current directory.

You can also skip the manual password input by using SSH and certificate authentication (out of scope). Have a look at the link underneath for available commands

Most, not all, of the Netscaler config is stored in this file /nsconfig/ns.conf on a netscaler vpx/mpx. (also have a look there)


Good luck with automation & orchestration