Perl example of deploying an iApp application service
Problem this snippet solves:
This is a perl script showing an example of how to deploy an iApp application service using iControl.
Code :
#!/usr/bin/perl # This is an example of how to deploy an iApp service using the f5.http # template. It'll almost certainly require some customization before it's ready # to be more than an example. use warnings; use strict; use SOAP::Lite; use iControlTypeCast; # customize these lines to use your BIG-IP and a working account my $sHost = "bwb-local"; my $sUID = "admin"; my $sPWD = "admin"; # These variables are specific to the f5.http template as it was written for # BIG-IP v11.1 and for a specific configuration. They need customized for # however it is that _you_ want to provision the application service that # results from this script. Entries to this array represent answers to the # questions that an iApp template asks a user (that are not tables, but see # below for those). my $scalar_vars = [ { name => "analytics__add_analytics", value =>; "No" }, { name => "intro__analytics_provisioned", value => "not_provisioned" }, { name => "intro__wam_provisioned ", value => "not_provisioned" }, { name => "intro__is_viprion", value => "false" }, { name => "analytics__analytics", value => "No" }, { name => "ssl_encryption_questions__offload_ssl", value => "No" }, { name => "basic__addr", value => "10.23.0.23" }, { name => "basic__port", value => "80" }, { name => "basic__snat", value => "No" }, { name => "basic__need_snatpool", value => "No" }, { name => "basic__using_ntlm", value => "No" }, { name => "server_pools__create_new_pool", value => "Create New Pool" }, { name => "server_pools__reuse_pool_name", value => "/Common/test-pool" }, { name => "server_pools__create_new_monitor", value => "Use Monitor..." }, { name => "server_pools__reuse_monitor_name", value => "/Common/http" }, { name => "server_pools__lb_method_choice", value => "round-robin" }, { name => "server_pools__tcp_request_queuing_enable_question", value => "No" }, { name => "optimizations__lan_or_wan", value => "LAN" }, ]; # This probably needs left empty my $list_vars = []; # This is where variables go that represent APL table widgets. Again, the values # present are just samples for the example - you'll need to change these. my $table_vars = [ { name => "server_pools__servers", column_names => [ "addr", "port", "connection_limit" ], values => [ [ "10.123.0.101", 80, 0 ], [ "10.123.0.102", 80, 0 ] ], } ]; # Leave this alone unless you have good reason to change it. It takes care of # the HTTP auth as part of SOAP. sub SOAP::Transport::HTTP::Client::get_basic_credentials { return "$sUID" => "$sPWD"; } # Acquire a handle to the portion of the iControl schema that lets us manipulate # iApp services and tell Perl's SOAP engine where to go. my $aso_handle = SOAP::Lite -> uri('urn:iControl:Management/ApplicationService') -> proxy("https://$sHost/iControl/iControlPortal.cgi"); # Actually make the 'create' call. If you wanted to deploy more than one service # at a time, you would just add parallel entries to each of the arrays. my $response = $aso_handle->create( SOAP::Data->name( apps => [ "my_http_test" ] ), SOAP::Data->name( templates => [ "f5.http" ] ), SOAP::Data->name( scalar_vars => [ $scalar_vars ] ), SOAP::Data->name( list_vars => [ $list_vars ] ), SOAP::Data->name( table_vars => [ $table_vars ] ), ); # If all goes well, nothing will be printed - but otherwise show the user what # went wrong. print $response->faultcode, " ", $response->faultstring, "\n" if $response->fault;
Published Mar 08, 2015
Version 1.0Brent_Blood_102
Historic F5 Account
Joined July 06, 2006
Brent_Blood_102
Historic F5 Account
Joined July 06, 2006
No CommentsBe the first to comment