Following script is ok, but it has to be modified with condition where i need help, or advice how to approach it, on place where i have to send expect for loadbalancing, if it is enabled, Yes, then i have to provide ip address of second node, i dont know how to make condition in expect, can you please help?
#!/usr/bin/expect
set timeout 2
spawn "./config.sh"
expect "Your choice:" { send "1\r" } expect "Do you want to select network (y/n)" { send "y\r" } expect "Please enter an address for the interface" { send "$env(IP)\r" } expect "Please enter the default gateway address" { send "$env(GW_IP)\r" } expect "Is this server" { send "y\r" } expect "Address range for the private network" { send "$env(PRIV_SUBNET)\r" } expect "Do you want to enable loadbalancing" { send "n\r" } expect "Please do you confirm (y/n):" { send "y\r" } expect "Do you want to clear the current configuration (first configuration)" { send "y\r" } expect "file already exist, do you want to replace it" { send "y\r" }
interact