F5 LTM bash script

Used when a new service is needed.

#!/bin/bash
read -p "What is the name of this Virtual Server ? " vs
read -p "What is the IP for the VIP ? " vip
read -p "What is the IP for the node 1? " node1_ip
read -p "What is the IP for the node 2? " node2_ip
read -p "What is the TCP/UDP port for this node?" port

newvs=$(echo $vs|tr '[a-z]''[A-Z]')
echo -e '\003\0014'
echo
echo Here is the config
echo
echo tmsh
echo "create ltm node $node1_ip { address $node1_ip monitor icmp }"
echo "create ltm node $node2_up { address $node2_ip monitor icmp }"
echo "create ltm virtual VS-$newvs-$port { members add { $node1_ip:$port { address $node1_ip } $node2_ip:$port { address $node2_ip }} monitor tcp }"
...

Leave a comment

Your email address will not be published. Required fields are marked *