ServiceNowITOM / ansible-sn-inventory

Ansible Dynamic Inventory for ServiceNow
Apache License 2.0
79 stars 45 forks source link

Ansible Tower ServiceNow Integration Failed #12

Open hd2212 opened 5 years ago

hd2212 commented 5 years ago

ISSUE TYPE Error dynamic inventory parsing. COMPONENT NAME API SUMMARY I'm basically following the steps mentioned in ansible servicenow integration official repo to integrate servicenow and get hosts from CMDB. I have all the dependencies installed ( python-configparser) and my ansible version is 2.7.0 and my tower version is 3.3.0 . I have the now.ini file in my /etc/ansible directory and also my now.py script. I have pasted the contents of now.py in my custom script contents in tower. Created an inventory and used the custom script in sources. I have all the credentials set up and also enabled .ini, script plugins in ansible.cfg file . When i'm trying to sync the inventory I'm facing the below error. Could anyone please help me out with resolving this problem? Please find the error below [WARNING]: * Failed to parse /tmp/awx_69_rRSdgQ/tmpZkM0LD with script plugin: Inventory script (/tmp/awx_69_rRSdgQ/tmpZkM0LD) had an execution error: Traceback (most recent call last): File "/tmp/awx_69_rRSdgQ/tmpZkM0LD", line 321, in main(sys.argv) File "/tmp/awx_69_rRSdgQ/tmpZkM0LD", line 316, in main inventory.generate() File "/tmp/awx_69_rRSdgQ/tmpZkM0LD", line 205, in generate content = self._invoke('GET', path, None) File "/tmp/awx_69_rRSdgQ/tmpZkM0LD", line 155, in invoke 'http': self.proxy, 'https': self.proxy}) File "/var/lib/awx/venv/ansible/lib/python2.7/site- packages/requests/sessions.py", line 535, in get return self.request('GET', url, kwargs) File "/var/lib/awx/venv/ansible/lib/python2.7/site- packages/requests/sessions.py", line 522, in request resp = self.send(prep, send_kwargs) File "/var/lib/awx/venv/ansible/lib/python2.7/site- packages/requests/sessions.py", line 642, in send r = adapter.send(request, **kwargs) File "/var/lib/awx/venv/ansible/lib/python2.7/site- packages/requests/adapters.py", line 503, in send raise ConnectionError(e, request=request) requests.exceptions.ConnectionError: HTTPSConnectionPool(host='none', port=443): Max retries exceeded with url: //ap i/now/table/cmdb_ci_server?sysparm_exclude_reference_link=true&sysparm_display value=true&sysparm_fields=sys_class_name,fqdn,ip_address,name,host_name (Caused by NewConnectionError('<requests.packages.urllib3.connection.VerifiedHTTPSConne ction object at 0x7f9fc37e23d0>: Failed to establish a new connection: [Errno -2] Name or service not known',)) [WARNING]: Unable to parse /tmp/awx_69_rRSdgQ/tmpZkM0LD as an inventory source ERROR! No inventory was parsed, please check your configuration and options.

ADDITIONAL INFORMATION Link to the now.py file. https://github.com/ServiceNowITOM/ansible-sn-inventory/blob/master/now.py

inversecow commented 3 years ago

While this may be an old post, it is presently not marked as resolved. In reviewing the output, the following immediately "jumps out" in the STDERR (below).

In short, it appears you have a network block, and thus are unable to "reach" your SN instance. If you have not figured it out already, check for connectivity to your "SN_INSTANCE_URL" on 443:TCP (from your TOWER node(s)). Also, check if you have SN_PROXY set as an ENV variable within the TOWER UI.

File "/var/lib/awx/venv/ansible/lib/python2.7/site-packages/requests/adapters.py", line 503, in send raise ConnectionError(e,request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='none', port=443):
Max retries exceeded with url: //api/now/table/cmdb_ci_server?sysparm_exclude_reference_link=true&sysparm_displayvalue=true&sysparm_fields=sys_class_name,fqdn,ip_address,name,host_name
(Caused by NewConnectionError('<requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x7f9fc37e23d0>: Failed to establish a new connection: [Errno-2] Name or service not known',))