xoanmi / ansible-module-infoblox

Awesome infobox module for ansible
GNU General Public License v3.0
38 stars 25 forks source link

request urllib3 pkg error #25

Open lorimariner opened 7 years ago

lorimariner commented 7 years ago

I installed this on Ansible 2.3.0.0 Python 2.7.5; Set my parameters for Infoblox and kept receiving errors: An exception occurred during task execution. To see the full traceback, use -vvv. The error was: AttributeError: 'module' object has no attribute 'urllib3' failed: [localhost] (item=test01.local) => {"failed": true, "item": "test01.local", "module_stderr": "Traceback (most recent call last):\n File \"/tmp/ansible_94H14V/ansible_module_infoblox.py\", line 8, in \n requests.packages.urllib3.disable_warnings()\nAttributeError: 'module' object has no attribute 'urllib3'\n", "module_stdout": "", "msg": "MODULE FAILURE", "rc": 0}

lorimariner commented 7 years ago

I discovered the the request module does not have the package urllib3 so with this entry: requests.packages.urllib3.disable_warnings() It continued to fail.

I modified by adding: import urllib3 urllib3.disable_warnings()

Fixed the error

lorimariner commented 7 years ago

I am able to connect and verify the existing hosts that are in Infoblox but continue to have this error output: TASK [Add host] ** task path: /var/lib/awx/projects/ansible-tower/infoblox_example.yml:7 Using module file /usr/share/my_modules/ansible-module-infoblox/infoblox.py <10.150.253.151> ESTABLISH LOCAL CONNECTION FOR USER: root <10.150.253.151> EXEC /bin/sh -c 'echo ~ && sleep 0' <10.150.253.151> EXEC /bin/sh -c '( umask 77 && mkdir -p "echo /root/.ansible/tmp/ansible-tmp-1500910719.66-264084341675421" && echo ansible-tmp-1500910719.66-264084341675421="echo /root/.ansible/tmp/ansible-tmp-1500910719.66-264084341675421" ) && sleep 0' <10.150.253.151> PUT /tmp/tmpyQ58Ax TO /root/.ansible/tmp/ansible-tmp-1500910719.66-264084341675421/infoblox.py <10.150.253.151> EXEC /bin/sh -c 'chmod u+x /root/.ansible/tmp/ansible-tmp-1500910719.66-264084341675421/ /root/.ansible/tmp/ansible-tmp-1500910719.66-264084341675421/infoblox.py && sleep 0' <10.150.253.151> EXEC /bin/sh -c '/usr/bin/python /root/.ansible/tmp/ansible-tmp-1500910719.66-264084341675421/infoblox.py; rm -rf "/root/.ansible/tmp/ansible-tmp-1500910719.66-264084341675421/" > /dev/null 2>&1 && sleep 0' The full traceback is: Traceback (most recent call last): File "/tmp/ansible_TJu_Sj/ansible_module_infoblox.py", line 771, in main() File "/tmp/ansible_TJu_Sj/ansible_module_infoblox.py", line 686, in main result = infoblox.create_host_record(host, network, address, comment) File "/tmp/ansible_TJu_Sj/ansible_module_infoblox.py", line 357, in create_host_record return self.invoke("post", "record:host?_return_fields=ipv4addrs", ok_codes=(200, 201, 400), json=payload) File "/tmp/ansible_TJu_Sj/ansible_module_infoblox.py", line 185, in invoke response.raise_for_status() File "/usr/lib/python2.7/site-packages/requests/models.py", line 937, in raise_for_status raise HTTPError(http_error_msg, response=self) requests.exceptions.HTTPError: 404 Client Error: Not Found for url: https://10.150.253.151/wapi/v1.7.1/record:host?_return_fields=ipv4addrs failed: [infoblox] (item=test01.local) => { "failed": true, "item": "test01.local", "module_stderr": "Traceback (most recent call last):\n File \"/tmp/ansible_TJu_Sj/ansible_module_infoblox.py\", line 771, in \n main()\n File \"/tmp/ansible_TJu_Sj/ansible_module_infoblox.py\", line 686, in main\n result = infoblox.create_host_record(host, network, address, comment)\n File \"/tmp/ansible_TJu_Sj/ansible_module_infoblox.py\", line 357, in create_host_record\n return self.invoke(\"post\", \"record:host?_return_fields=ipv4addrs\", ok_codes=(200, 201, 400), json=payload)\n File \"/tmp/ansible_TJu_Sj/ansible_module_infoblox.py\", line 185, in invoke\n response.raise_for_status()\n File \"/usr/lib/python2.7/site-packages/requests/models.py\", line 937, in raise_for_status\n raise HTTPError(http_error_msg, response=self)\nrequests.exceptions.HTTPError: 404 Client Error: Not Found for url: https://10.150.253.151/wapi/v1.7.1/record:host?_return_fields=ipv4addrs\n", "module_stdout": "", "msg": "MODULE FAILURE", "rc": 0 } to retry, use: --limit @/var/lib/awx/projects/ansible-tower/infoblox_example.retry

PLAY RECAP *** infoblox : ok=0 changed=0 unreachable=0 failed=1

lorimariner commented 7 years ago

the last httperror is this: { "Error": "AdmConProtoError: Unknown argument/field: 'ipv4addrs\n\"'", "code": "Client.Ibap.Proto", "text": "Unknown argument/field: 'ipv4addrs\n\"'" }

seph3 commented 6 years ago

I have same issue for action "get_a_record"

fatal: [localhost]: FAILED! => { "changed": false, "module_stderr": "Traceback (most recent call last):\n File \"/tmp/ansible_TNQH5i/ansible_module_infoblox.py\", line 185, in \n requests.packages.urllib3.disable_warnings()\nAttributeError: 'module' object has no attribute 'urllib3'\n", "module_stdout": "", "msg": "MODULE FAILURE", "rc": 0

My configuration: ansible-playbook 2.4.2.0 config file = /etc/ansible/ansible.cfg configured module search path = [u'/usr/share/ansible/modules'] ansible python module location = /usr/lib/python2.7/site-packages/ansible executable location = /bin/ansible-playbook python version = 2.7.5 (default, May 3 2017, 07:55:04) [GCC 4.8.5 20150623 (Red Hat 4.8.5-14)]