THE GAME HAS CHANGED

Introducing Infoblox Universal DDI ManagementTM

Watch the launch to discover the new era of management for critical network services. Watch Now

API & Integration, DevOps,NetOps,SecOps

Reply

Issues with infoblox-client in Ansible.

New Member
Posts: 1
17878     0

Hi!

 

I experience some issues using the infoblox-client in Ansible. We want to automate some of our Infoblox tasks and I'm trying to do just that with the help of Ansible.

 

I created an initial playbook using the "lookup" module provided by the infoblox-client to fetch a host record. But upon running the playbook i get the following error/message:

 

fatal: [***.***.***.***]: FAILED! => {"msg": "An unhandled exception occurred while running the lookup plugin 'nios'. Error was a <type 'exceptions.Exception'>, original message: infoblox-client is required but does not appear to be installed.  It can be installed using the command `pip install infoblox-client`"}

This is strange because the infoblox-client module has been installed and is listed when performing the "pip list" command.

 

The playbook looks as followed:

 

 

---
- hosts: ********
  connection: local
  vars:
    nios_provider:
      host: ********
      username: ********
      ssl_verify: no
  tasks:
    - name: Fetch host test
      set_fact:
         host: "{{ lookup('nios', 'record:host', filter={'name': 'test.ansible.com'}, provider=nios_provider) }}"
...

Anybody has experience with this issue or knows how to deal with it?

 

Thanks in advance

 

Lennert

 

Re: Issues with infoblox-client in Ansible.

New Member
Posts: 3
17878     0

Hey Lennert,

 

I'm not posting the solution, but if you have got the soluation from somewhere else, please let me know here.

I'm also facing the same issue and I'm totally stuck.

TIA

Re: Issues with infoblox-client in Ansible.

Adviser
Posts: 109
17878     0

The infoblox-client package is the interface for the RESTful API (WAPI) connection to NIOS and requires Python version 2.6 or newer to work properly. If you have the infoblox-client package installed but are still seeing this error, the next thing that I would check is that Python is installed and has been updated to a compatible version.

 

Regards,

Tony

Re: Issues with infoblox-client in Ansible.

New Member
Posts: 3
17878     0

Tony,

 

I am currently using Python version 3.6.3 with ansible and still getting the error.

Is there anything else I need to check or install or validate? 

 

Regards,

Abhinav 

Re: Issues with infoblox-client in Ansible.

Adviser
Posts: 109
17878     0

It may be that you are missing another dependency that is covered by default in the builds I have tested with. Try installing python-dev to see if that helps clear the error.

 

Regards,

Tony

Re: Issues with infoblox-client in Ansible.

New Member
Posts: 3
17879     0

Installed python-devel package with latest version, still no luck with eliminating the error.

Re: Issues with infoblox-client in Ansible.

Adviser
Posts: 181
17879     0

Hi,

 

The issue you see could be because you use python 3.6, but you installed the infoblox-client with pip (which uses 2.x version). You can re-install the client using pip3 as below (if pip3 is not present on your system, first install it using apt install python3-pip):

pip3 install infoblox-client

pip3 show infoblox-client
---
Metadata-Version: 2.1
Name: infoblox-client
Version: 0.4.22
Summary: Client for interacting with Infoblox NIOS over WAPI
Home-page: https://github.com/infobloxopen/infoblox-client
Author: John Belamaric
Author-email: jbelamaric@infoblox.com
Installer: pip
License: Apache
Location: /usr/local/lib/python3.5/dist-packages
Requires: setuptools, urllib3, requests, oslo.log, oslo.serialization
Classifiers:
  Development Status :: 3 - Alpha
  Intended Audience :: Developers
  License :: OSI Approved :: Apache Software License
  Natural Language :: English
  Programming Language :: Python :: 2
  Programming Language :: Python :: 2.7
  Programming Language :: Python :: 3
  Programming Language :: Python :: 3.4
  Programming Language :: Python :: 3.5
  Programming Language :: Python :: 3.6

Hope this helps,

Krishna

 

Re: Issues with infoblox-client in Ansible.

[ Edited ]
New Member
Posts: 1
17879     0

Anyone get it working? I am seeing the same issue. (I used pip3 so not that)

 

EDIT:

never mind... I found that ansible was using python2 so I was installing the mod in the wrong place... both pip, pip2 and pip3 were all installing it for python3.  "python2 -m pip install infoblox-client" did the trick to get it working until I switch ansible to python3

Re: Issues with infoblox-client in Ansible.

New Member
Posts: 1
17879     0

I have a similar problem but have not found a solution.  I have my Ansible controller on CentOS 8.  I chose that version because I wanted a system version where the native system python version is python3.  Ansible works fine, except for nios_next_ip, which gives me the error:

 

'An unhandled exception occurred while running the lookup plugin ''nios_next_ip''. Error was a <class ''Exception''>, original message: infoblox-client is required but does not appear to be installed. It can be installed using the command `pip install infoblox-client`

 

I have already installed infoblox-client successfully in pip3 and pip2 so it is available in both python versions.  Ansible is in my pip3 installed list, which is what I intended.

 

The only unusual thing I'm finding is that infoblox_client (and others) are installed in /usr/local/lib/python3.6/site-packages instead of /usr/lib/python3.6/site-packages. 

 

Copying the installed folder to /usr/lib/python3.6/site-packages did not help.

 

I have successfully used nios_host_record in plays so my basic setup, provider credentials, etc., are all fine.

 

Anyone have ideas?

 

Re: Issues with infoblox-client in Ansible.

New Member
Posts: 1
17879     0

Hello, same problem with AWX and Infloblox Python client

 

2020-03-10 18_26_24-Ansible AWX _ 567 - [POC] Infoblox.png

 

AWX 9.2.0 with Ansible 2.9.3 

 

 infoblox-client was installed on python venv used by awx with pip2 and pip3 .


any help is appreciated Smiley Happy

Re: Issues with infoblox-client in Ansible.

Techie
Posts: 3
17879     0

Same problem here - Does infoblox client work with Python 3?

Re: Issues with infoblox-client in Ansible.

[ Edited ]
New Member
Posts: 1
17879     0

I would suggest that you compare where infoblox-client is installed vs ansible python module location.

Like what Krisna mentioned

 

$ pip3 show infoblox-client
Name: infoblox-client
Version: 0.5.0
Summary: Client for interacting with Infoblox NIOS over WAPI
Home-page: https://github.com/infobloxopen/infoblox-client
Author: John Belamaric
Author-email: jbelamaric@infoblox.com
License: Apache
Location: /usr/local/lib/python3.6/site-packages
Requires: setuptools, oslo.log, urllib3, oslo.serialization, requests, six

 

$ ansible --version
ansible 2.9.9
config file = /etc/ansible/ansible.cfg
configured module search path = ['/home/ansible/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/local/lib/python3.6/site-packages/ansible
executable location = /usr/local/bin/ansible
python version = 3.6.8 (default, Nov 21 2019, 19:31:34) [GCC 8.3.1 20190507 (Red Hat 8.3.1-4)]

 

(Edit)
I had a peer tell me of a way around the infoblox-client not installed message by adding the ansible_python_interpreter to the ansible-playbook command

 

this system has an older install of ansible.

$ ansible-playbook playbook.yml -e 'ansible_python_interpreter=/usr/bin/python2.7'

if you do a little digging for that you will find the variable that can be set in the ansible.cfg file 

 

I would imagine a similar entry would work for a install using python3 

Re: Issues with infoblox-client in Ansible.

New Member
Posts: 2
17879     0

Hello,

 

My default ansible environment doesn't work with infoblox-client but my customvenv yes!

In my containers (awx_task / awx_web) there are same modules (in /venv/ansible)... and I have installed infoblox-client with this command : "pip install infoblox-client"

 

Note : with "pip3 install infoblox-client" I have the same issue

 

"msg": "An unhandled exception occurred while running the lookup plugin 'nios'. Error was a <class 'Exception'>, original message: infoblox-client is required but does not appear to be installed. It can be installed using the command `pip install infoblox-client`"

 

Is there an issue with python 3.6.8 ? (custom virtualenv works with python 3.8.5)

Showing results for 
Search instead for 
Did you mean: 

Recommended for You