Forum Discussion

kiran_124903's avatar
kiran_124903
Icon for Nimbostratus rankNimbostratus
Jan 19, 2017

Any clues on how to use api of f5 to create and delete virtual server ?

Did any one worked on a script which will use api calls to create and delete virtual server , pool, snatpool and nodes on ltm.

 

If so can you please post the script.

 

In other words I am looking to automate virtual server creation, any help in that direction is also appreciated, mostly I am trying with opensource..

 

1 Reply

  • Hello Kiran,

     

    You can use TMSH command to create/delete VS, pool, nodes and other objects...

     

    Create a Pool: tmsh create ltm pool "pool-name" monitor "monitor-name" load-balancing-mode "load-balancing-method-name" members add { "pool-member-name1":port { address "x.x.x.x" } "pool-member-name2":port { address "x.x.x.x" } }

     

    Create a VS: tmsh create ltm virtual "vs-name" { destination "x.x.x.x:port" pool "pool-name" persist replace-all-with { "persistence-profile-name" } fallback-persistence none rules { "irule-name1" "irule-name2"} vlans-enabled vlans replace-all-with { "vlan-name" } profiles add { "profile-name1" "profile-name2" } snat automap }

     

    Delete a Pool: tmsh delete ltm pool "pool-name"

     

    Delete a VS: tmsh delete ltm virtual "vs-name"

     

    N.B: You cannot delete an object if it is already referenced in an another object, you must first remove it from that object.

     

    You can use the "modify" command to modify an existing object.

     

    For more info about the tmsh command you have all the command :

     

    https://support.f5.com/content/kb/en-us/products/big-ip_ltm/manuals/product/bigip-tmsh-11-5-0/_jcr_content/pdfAttach/download/file.res/bigip-tmsh-11-5-0.pdf

     

    If you have developpment skills in python, perl, java, php or .net and you want to use REST or SOAP APIs you can use iControl

     

    https://devcentral.f5.com/articles/sid/6985

     

    Hope that it helps

     

    Regards