cancel
Showing results for 
Search instead for 
Did you mean: 
Login & Join the DevCentral Connects Group to watch the Recorded LiveStream (May 12) on Basic iControl Security - show notes included.
George_Watkins_
Historic F5 Account

Problem this snippet solves:

This is a script will do an A record lookup for a hostname and populate the specified pool with all available A records. The script will not change the existing pool member(s) or modify their connections if the next A record matches. Only changes to the associated A record will result in changes to the pool members. The script will error out and print a help message if any of the following conditions are met: 6 arguments are not provided (BIG-IP address, BIG-IP user, BIG-IP password, A record query, pool name, pool member port), the port is an invalid integer (valid ports: 1-65535), BIG-IP connection cannot be made, the pool does not exist, or no A record returned.

How to use this snippet:

Requirements

  • Ruby
  • Ruby Gems
  • F5 iControl for Ruby library (https://devcentral.f5.com/Tutorials/TechTips/tabid/63/articleType/ArticleView/articleId/1086421/Getting-Started-With-Ruby-and-iControl.aspx)
  • other dependencies will be installed with the iControl gem

Installation Steps

  1. Install Ruby, Ruby's OpenSSL library, Ruby Gems, and the Ruby iControl libraries
  2. Copy this code to /usr/local/bin and chmod +x to make the script executable
  3. Run it!
    • change-pool-member-to-a-record-result <BIG-IP address> <BIG-IP user> <BIG-IP password> < A record query> < pool name> < pool member port>

Code :

#!/usr/bin/ruby

require 'rubygems'
require 'f5-icontrol'
require 'resolv'

def usage
  puts $0 + '      '
  exit
end

# make sure enough arguments have been provided
usage if $*.size < 6
$*[5] = $*[5].t...
Version history
Last update:
‎09-Mar-2015 11:24
Updated by:
Contributors