Forum Discussion

sundogbrew's avatar
sundogbrew
Icon for Altocumulus rankAltocumulus
Feb 21, 2013

Bulk management of pools...

So this is more of the same questions concerning my tons of apps with the same pool members. I have written a pretty basic tmsh script that creates my applications for me which has become a lifesaver! Now I have to be able to figure out a way to change all my pools easily without the use of the GUI.

 

When I started creating the applications I grouped them together by name so I have TFA Test Fast Application and PFA Prod Fast Application. So when my script creates the monitor it

 

creates TFA-[appname]-port

 

then it creates TFA-[appname]_pool

 

then it creates TFA-[virtualhost]

 

So all the names come together as TFA or PFA. What I need to do is add and remove nodes from all the pools easily. Any ideas on this? I know I can use the modify pool command but how about a way to say modify pool "TFA-*-pool and it will change all the pools at once. Or a way to use the list command to say list all the TFA pools and push them through a modify command. I wrote a quick script that prompts what pool do you want to change and I added the ip changes to the script, but if I try to answer the prompt with TFA-*-pool it says something about not being able to use it. Putting in the name works but once I have 50 - 100 pools this isn't going to be a solution. I need to be able to script this.

 

Any help would be greatly appreciated!

 

Thank you as always!

 

Joe

 

3 Replies

  • How about a shell script that creates the list of desired pool members and lets you loop through them. Something like the following:

    
    ! /bin/bash
    output=$(tmsh list ltm pool |grep "ltm pool" | awk -F" " '{ print $3 }' |grep TFA-*)
    for LINE in ${output}; do
       echo ${LINE}
        process each TFA pool in this loop
    done
    

  • Kevin, you rock!

     

    So then just do a while loop that takes the output from that script and runs it through a tmsh modify command?

     

     

    Thanks so much!

     

    Joe
  • You're already in a for loop, so each iteration through will have the name of one of the TFA-* pools.