Skip to content
Snippets Groups Projects
README.md 2.28 KiB
Newer Older
  • Learn to ignore specific revisions
  • igor-feoktistov's avatar
    igor-feoktistov committed
    # Infoblox API
    
    This project implements the subset of Infoblox API via REST API
    
    ## Infoblox API python module
    
    Class **Infoblox** implements the following methods:
    
    - create_network
    - delete_network
    - create_networkcontainer
    - delete_networkcontainer
    
    - get_next_available_network
    
    igor-feoktistov's avatar
    igor-feoktistov committed
    - create_host_record
    
    Nigel Samaroo's avatar
    Nigel Samaroo committed
    - create_txt_record
    
    igor-feoktistov's avatar
    igor-feoktistov committed
    - delete_host_record
    
    Nigel Samaroo's avatar
    Nigel Samaroo committed
    - delete_txt_record
    
    igor-feoktistov's avatar
    igor-feoktistov committed
    - add_host_alias
    - delete_host_alias
    - create_cname_record
    - delete_cname_record
    
    - update_cname_record
    
    igor-feoktistov's avatar
    igor-feoktistov committed
    - create_dhcp_range
    - delete_dhcp_range
    - get_next_available_ip
    - get_host
    - get_host_by_ip
    - get_ip_by_host
    - get_host_by_extattrs
    
    igor-feoktistov's avatar
    igor-feoktistov committed
    - get_host_by_regexp
    
    Nigel Samaroo's avatar
    Nigel Samaroo committed
    - get_txt_by_regexp
    
    igor-feoktistov's avatar
    igor-feoktistov committed
    - get_host_extattrs
    - get_network
    - get_network_by_ip
    - get_network_by_extattrs
    - get_network_extattrs
    - update_network_extattrs
    - delete_network_extattrs
    
    * * *
    
    ### How to use
    
    Example:
    
    ```
    import infoblox
    
    
    iba_api = infoblox.Infoblox('10.10.20.32', 'admin', 'secret', '1.6', 'internal', 'default')
    
    igor-feoktistov's avatar
    igor-feoktistov committed
    
    try:
    
        ip = iba_api.create_host_record('192.168.0.0/24', 'mytest.example.com')
        print ip
    
    igor-feoktistov's avatar
    igor-feoktistov committed
    except Exception as e:
        print e
    
    ```
    
    
    ## Infoblox CLI tool
    
    a simple command line tool to quickly manipulate the infoblox database using the WAPI
    
    ### How to use
    
    
    Markus Wigge's avatar
    Markus Wigge committed
    1. create an infoblox user with api access
    1. put the credentials in a local config file "~/.ib-cli.conf"
    
    ```
    [configuration]
    
    apihost: <infoblox-hostname>
    
    apiuser: <username>
    apipass: <apipassphrase>
    ```
    
    Markus Wigge's avatar
    Markus Wigge committed
    1. call the command with appropriate arguments (-h for help)
    
    
    ```
    usage: ib-cli [-h] [--view {default,external}]
                  {get_host,get_host_by_ip,create_host_record,delete_host_record}
                  ...
    
    optional arguments:
      -h, --help            show this help message and exit
      --view {default,external}
                            DNS view
    
    commands:
      {get_host,get_host_by_ip,create_host_record,delete_host_record}
        get_host            retrieve hostobject by fqdn
        get_host_by_ip      retrieve hostname by ip address
        create_host_record  create new host object
        delete_host_record  delete an host object
    
    Markus Wigge's avatar
    Markus Wigge committed
    
    
    $./ib-cli.py get_host myhost.domain.local
    
    No hosts found: myhost.domain.local
    
    $ ./ib-cli.py get_host_by_ip 10.10.10.5
    No host records found for IP: 10.10.10.5
    
    $ ./ib-cli.py create_host_record 10.10.10.5 myhost.domain.local
    10.10.10.5
    
    $ ./ib-cli.py delete_host_record myhost.domain.local
    None
    ```