Tuesday, April 13, 2010

ibcli - a command line tool for infoblox management

        As a long time infoblox customer I was really excited about the recent major redo of the administrative interface. The slow, windows-only-java-based eclipse gui is gone and replaced with a much nicer and faster html/ajax interface. It is still far from intuitive, but at least we no longer have to rdesktop or spin up a vm for dns/dhcp changes. The new interface seems to have all the functionality that the old one did, but really hasn't added anything that approaches the flexibility you can achieve from using the perl API.
        I recently found out about something even better than a fancy ajax gui, which is a new program called ibcli. ibcli is billed as "A command line tool for Infoblox Databases" and is a both an odd and interesting project to me. It is a single perl script with very good documentation, clean looking code, and seemingly no user community. In fact I really can't find any mention of it anywhere else online, but it seems that the project has been online for more than a year and is at version 3.46. The following example usage is me using ibcli to:

  1. determine the ip space used for site.mydomain.com because I wasn't sure what space.
  2. reserving ip addresses below .10 for future use with A records for reserved.site.mydomain.com.
  3. creating a host object with a static dhcp reservation.

The 3rd item was all I intended to do, 1 and 2 were slight detours along the way.

username$ perl ibcli 
 
#####################################################################
#
# the Infoblox CLI Revision: 3.46  (this is beta code, ymmv)
#
#####################################################################

( press  for help )
server ? >   bye configure download exit help history quit restart show test upload
server ? >

tab completion is a nice plus.

server> conf server 10.10.1.10 user username password *******
username@10.10.1.10 > sh host site.mydomain.com
--- ---
             configure_for_dns : true
                     ipv4addrs : 10.4.1.98
                          name : xml-site.mydomain.com
                  network_view : default
                           ttl : 3600
                       use_ttl : 1
                         views : default
                          zone : mydomain.com
--- ---
             configure_for_dns : true
                     ipv4addrs : 10.7.5.1
                          name : router.site.mydomain.com
                  network_view : default
                         views : default
                          zone : site.mydomain.com
--- ---
             configure_for_dns : true
                     ipv4addrs : 10.7.5.2
                          name : site-sw-1.site.mydomain.com
                  network_view : default
                         views : default
                          zone : site.mydomain.com
--- ---
username@10.10.1.10 > show network 10.7.5.0/24 ipam next_available
  10.7.5.0/24 : 10.7.5.5
username@10.10.1.10 > conf zone site.mydomain.com add a_record reserved 10.7.5.5
username@10.10.1.10 > show network 10.7.5.0/24 ipam next_available
  10.7.5.0/24 : 10.7.5.6
username@10.10.1.10 > conf zone site.mydomain.com add a_record reserved 10.7.5.6
username@10.10.1.10 > show network 10.7.5.0/24 ipam next_available
  10.7.5.0/24 : 10.7.5.13
username@10.10.1.10 > conf zone site.mydomain.com add host marketing-printer-1 10.7.5.13:00:00:85:BA:0B:5B comment "new printer 4/11/10 -username"
username@10.10.1.10 > restart dhcp member 69.2.92.110

You can also schedule a change to happen in the future by appending "at DateTime String" to the conf command.

username@10.10.1.10 > conf zone mydomain.com add host jl-test-1 1.2.3.4 at 2010-04-14T14:15:00-04:00
username@10.10.1.10 > show grid schedule
              changed_objects : Infoblox::Grid::ScheduledTask::ChangedObject=HASH(0x104c08018)
                scheduled_time : 2010-04-14T18:15:00Z
                   submit_time : 2010-04-13T17:39:35Z
                     submitter : username
                       task_id : 2


        There is really no need for me to try all of the features (batch commands look nice), but most everything I've tried has worked nicely. The author of the script is clear about this being "beta code", so use of this is completely at your own risk. Enjoy.

0 comments:

Post a Comment