Forum Discussion
Virtual Server Scripting
Hi All
We have a LTM/APM configuration, and have customised the APM logon screen. We now have quite a number of virtual servers and currently to put the virtual servers into maintenance we change the Access Profile setting (located on the virtual server dialog), plus we also change the Default Pool and point to a server holding a variety of maintenance pages, which are in the same style as the logon pages. I've been looking, and failing to find, a way to script changing the access profile setting via a script, preferably using powershell.
So is it even possible to change the access profile setting via a script?
Any help would be appriciated
2 Replies
just changing the access policy shouldn't be an issue i believe. you probably want to look at iControl to make this happen.
- Kevin_Stewart
Employee
If you're running 11.4 or above you could incorporate the new iControl REST API. Here's what that might look like with cURL:
Removing the access profile:
curl -sk -u admin:admin -X DELETE https://x.x.x.x/mgmt/tm/ltm/virtual/my_vs/profiles/my_access_profileAdding the access profile:
curl -sk -u admin:admin -X POST https://x.x.x.x/mgmt/tm/ltm/virtual/my_vs/profiles -d '{"name":"my_access_profile"}' -H "Content-Type: application/json"It'd be pretty straight forward to incorporate these REST calls into a Perl, Python, PowerShell, or Bash script.
You could also, alternatively, use a data group to manage maintenance. Something like this:
when HTTP_REQUEST { if { [class match [virtual] equals maint_mode] } { ACCESS::disable pool maintmode_pool } }where "maint_mode" is a string-based data group containing the names of virtual servers that you want to be in maintenance mode. Example:
ltm data-group internal maint_mode { records { /Common/my-vs1 { } } type string }
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com