Forum Discussion

Patrick_Harring's avatar
Patrick_Harring
Icon for Nimbostratus rankNimbostratus
Oct 09, 2013
Solved

Is there an example of simple non-interactive iapp that configures a profile, monitor, node, pool, and virtual?

Greetings,

 

I was in a class recently where we used an iApp to change the configuration on the LTM. I thought this technique was brilliant because the actual amount of interaction with the device was very limited. Becuase of the way my organization implements its configurations, such an iApp would be very useful to me and reduce the time required to author routine configurations deliverables.

 

Unfortunately, the example iApps are extremely large and complex and interactive. I am looking just for the simplest of iApps, that just configures a profile, monitor, node, pool, and virtual, with the commands "hard-coded" into the script; no form fields for anyone to fill out. Just press a button and BOOM the configuration is added.

 

I just need a simple and practical example to start with. From there, I can tweak it into a template using variables and decision statements, but I need something simple to start from.

 

Any help would be greatly appreciated.

 

  • This should work for you:

        sys application template /Common/f5.hardcoded {
        actions {
            definition {
                html-help {
                }
                implementation {
    
    proc tmsh_create { args } {
        set args [join $args]
        puts "tmsh create $args"
        tmsh::create $args
        return [lindex $args [lsearch -glob $args "*_*"]]
    }
    
    tmsh_create ltm virtual ${tmsh::app_name}_vip \
        destination 10.10.10.1:80 \
        pool [tmsh_create ltm pool ${tmsh::app_name}_pool \
        members replace-all-with \{ \
            10.1.1.1:80 \
            10.1.1.2:80 \
            10.1.1.3:80 \
        \} \
        load-balancing-mode least-connections-member \
        monitor  [tmsh_create \
             ltm monitor http ${tmsh::app_name}_http]] \
        persist  replace-all-with \{[tmsh_create \
             ltm persistence source-addr ${tmsh::app_name}_source_ip]\} \
        profiles replace-all-with \{[tmsh_create \
             ltm profile http ${tmsh::app_name}_http]\} \
        ip-protocol tcp \
        snat automap
                }
                macro {
                }
                presentation {
    section intro {
        message hello
    }
    text {
        intro "Hard-Coded Implementation"
        intro.hello " " "Just click Finished."
    }
                }
                role-acl none
                run-as none
            }
        }
    }
    

4 Replies

  • Fred_Slater_856's avatar
    Fred_Slater_856
    Historic F5 Account

    This should work for you:

        sys application template /Common/f5.hardcoded {
        actions {
            definition {
                html-help {
                }
                implementation {
    
    proc tmsh_create { args } {
        set args [join $args]
        puts "tmsh create $args"
        tmsh::create $args
        return [lindex $args [lsearch -glob $args "*_*"]]
    }
    
    tmsh_create ltm virtual ${tmsh::app_name}_vip \
        destination 10.10.10.1:80 \
        pool [tmsh_create ltm pool ${tmsh::app_name}_pool \
        members replace-all-with \{ \
            10.1.1.1:80 \
            10.1.1.2:80 \
            10.1.1.3:80 \
        \} \
        load-balancing-mode least-connections-member \
        monitor  [tmsh_create \
             ltm monitor http ${tmsh::app_name}_http]] \
        persist  replace-all-with \{[tmsh_create \
             ltm persistence source-addr ${tmsh::app_name}_source_ip]\} \
        profiles replace-all-with \{[tmsh_create \
             ltm profile http ${tmsh::app_name}_http]\} \
        ip-protocol tcp \
        snat automap
                }
                macro {
                }
                presentation {
    section intro {
        message hello
    }
    text {
        intro "Hard-Coded Implementation"
        intro.hello " " "Just click Finished."
    }
                }
                role-acl none
                run-as none
            }
        }
    }
    
  • Thanks for that writeup, Fred. It gives me a good starting point, and some ideas are brewing in my head how to make this work efficiently for me. Just have to figure out how to make them work =)

     

    • Fred_Slater_856's avatar
      Fred_Slater_856
      Historic F5 Account
      If you prefer the command line or a script, you can also execute this as a tmsh command without using the GUI. tmsh create sys app service my_custom_app template f5.hardcoded
    • Patrick_Harring's avatar
      Patrick_Harring
      Icon for Nimbostratus rankNimbostratus
      Oh thank you very much for that. I was trying to figure that out. That will make it even easier for my operations group.