ansible,

Ansible for Infoblox

Gineesh Gineesh Follow · 2 mins read
Ansible for Infoblox
Share this

Configure Ansible for Infoblox

Install Python3 on RHEL

https://developers.redhat.com/blog/2018/08/13/install-python3-rhel/#why-rhscl

$ su -
# subscription-manager repos --enable rhel-7-server-optional-rpms \
  --enable rhel-server-rhscl-7-rpms
# yum -y install @development
# yum -y install rh-python36
 
# yum -y install rh-python36-numpy \
 rh-python36-scipy \ 
 rh-python36-python-tools \
 rh-python36-python-six

Instal Python3 on Centos

# yum install -y python3

Setup Python VirtualEnv (venv)

$ scl enable rh-python36 bash
$ python3 -V
Python 3.6.3
 
$ python -V  # python now also points to Python3 
Python 3.6.3
 
$ mkdir ~/pydev
$ cd ~/pydev
 
$ python3 -m venv py36-venv
$ source py36-venv/bin/activate
 
(py36-venv) $ python3 -m pip install ...some modules...

DONOT Upgrade pip to Latest !!!

$ python -m pip install pip==20.2.3

Install Ansible

## install required packages
pip install wheel setuptools rust etc

pip install ansible

Install infoblox Client

pip install infoblox-client

Infoblox API References

Find the WAPI documentation from https://<GRID_IP_ADDRESS>/wapidoc/ url.

## list WAPI versions
https://10.10.10.10/wapi/v1.0/?_schema

## samples
https://10.6.1.216/wapi/v2.7/networkview?name=default
https://10.6.1.216/wapi/v2.7/networkview?name=default&_return_type=json

## get the rpz url entry
https:///wapi//allrpzrecords?zone=&_return_fields%2B=rpz_rule&_return_as_object=1&name="

Sample API Calls

$ curl -k -s \
  -H 'content-type: application/json' \
  -X POST \
  --user admin:adminadmin \
  "https://10.6.1.216/wapi/v2.7/record:rpz:a?_return_fields%2B=name,rp_zone&_return_as_object=1" \
  -d '{"name":"serverblock.com.category-01","ipv4addr":"1.1.1.156","rp_zone":"category-01"}'

  "https://10.6.1.216/wapi/v2.11/record:rpz:a?_return_fields%2B=name,rp_zone&_return_as_object=1"

Appendix

Gineesh
Written by Gineesh Follow
Author, Automation and Containerization Guy, techbeatly.com/youtube

Latest Stories

Featured