Configuring Citrix Netscaler using SSH from a remote computer

Hi,

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

Citrix wrote an article about this http://support.citrix.com/article/CTX116453

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:

#!/bin/bash
echo “Netscaler VPX (Instance) configuration”
ssh -T nsroot@192.168.2.241 << EOF > log.txt
add ns trafficDomain 67 -aliasName 67
add ns trafficDomain 88 -aliasName 88
exit
exit
EOF

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

http://support.citrix.com/proddocs/topic/ns-reference-map-10-5/netscaler-crg-gen-wrapper-con.html

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

 

Ronny.