ansible-collections / servicenow.itsm

Ansible Collection for ServiceNow ITSM
GNU General Public License v3.0
89 stars 78 forks source link

EDC9501I The name does not resolve for the supplied parameters. #411

Closed adn1107 closed 5 days ago

adn1107 commented 6 days ago
The full traceback is:
  File "/tmp/ansible_servicenow.itsm.incident_payload_210grvl3/ansible_servicenow.itsm.incident_payload.zip/ansible_collections/servicenow/itsm/plugins/modules/incident.py", line 339, in main
  File "/tmp/ansible_servicenow.itsm.incident_payload_210grvl3/ansible_servicenow.itsm.incident_payload.zip/ansible_collections/servicenow/itsm/plugins/modules/incident.py", line 285, in run
  File "/tmp/ansible_servicenow.itsm.incident_payload_210grvl3/ansible_servicenow.itsm.incident_payload.zip/ansible_collections/servicenow/itsm/plugins/modules/incident.py", line 253, in ensure_present
  File "/tmp/ansible_servicenow.itsm.incident_payload_210grvl3/ansible_servicenow.itsm.incident_payload.zip/ansible_collections/servicenow/itsm/plugins/module_utils/table.py", line 28, in get_record
    return self.get(self.path(table), query, must_exist)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/ansible_servicenow.itsm.incident_payload_210grvl3/ansible_servicenow.itsm.incident_payload.zip/ansible_collections/servicenow/itsm/plugins/module_utils/snow.py", line 49, in get
    records = self.list(api_path, query)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/ansible_servicenow.itsm.incident_payload_210grvl3/ansible_servicenow.itsm.incident_payload.zip/ansible_collections/servicenow/itsm/plugins/module_utils/snow.py", line 28, in list
    response = self.client.get(
               ^^^^^^^^^^^^^^^^
  File "/tmp/ansible_servicenow.itsm.incident_payload_210grvl3/ansible_servicenow.itsm.incident_payload.zip/ansible_collections/servicenow/itsm/plugins/module_utils/client.py", line 198, in get
    resp = self.request("GET", path, query=query)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/ansible_servicenow.itsm.incident_payload_210grvl3/ansible_servicenow.itsm.incident_payload.zip/ansible_collections/servicenow/itsm/plugins/module_utils/client.py", line 187, in request
    headers = dict(headers or DEFAULT_HEADERS, **self.auth_header)
                                                 ^^^^^^^^^^^^^^^^
  File "/tmp/ansible_servicenow.itsm.incident_payload_210grvl3/ansible_servicenow.itsm.incident_payload.zip/ansible_collections/servicenow/itsm/plugins/module_utils/client.py", line 90, in auth_header
    self._auth_header = self._login()
                        ^^^^^^^^^^^^^
  File "/tmp/ansible_servicenow.itsm.incident_payload_210grvl3/ansible_servicenow.itsm.incident_payload.zip/ansible_collections/servicenow/itsm/plugins/module_utils/client.py", line 95, in _login
    return self._login_oauth()
           ^^^^^^^^^^^^^^^^^^^
  File "/tmp/ansible_servicenow.itsm.incident_payload_210grvl3/ansible_servicenow.itsm.incident_payload.zip/ansible_collections/servicenow/itsm/plugins/module_utils/client.py", line 127, in _login_oauth
    resp = self._request(
           ^^^^^^^^^^^^^^
  File "/tmp/ansible_servicenow.itsm.incident_payload_210grvl3/ansible_servicenow.itsm.incident_payload.zip/ansible_collections/servicenow/itsm/plugins/module_utils/client.py", line 161, in _request
    raise ServiceNowError(e.reason)
fatal: [zos_host]: FAILED! => {
    "changed": false,
    "invocation": {
        "module_args": {
            "attachments": null,
            "caller": null,
            "close_code": null,
            "close_notes": null,
            "description": null,
            "hold_reason": null,
            "impact": "high",
            "incident_mapping": null,
            "instance": {
                "access_token": null,
                "api_path": "api/now",
                "client_id": "0f3df1d8e2220210650f5ceca0f74996",
                "client_secret": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
                "custom_headers": null,
                "grant_type": null,
                "host": "https://dev195580.service-now.com",
                "password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
                "refresh_token": null,
                "timeout": null,
                "username": "admin",
                "validate_certs": false
            },
            "number": "INC0013556",
            "other": null,
            "short_description": null,
            "state": "in_progress",
            "sys_id": null,
            "urgency": "high"
        }
    },
    "msg": "[Errno 1] EDC9501I The name does not resolve for the supplied parameters."
}

What is my problem please? Can't find anything with Google.

adn1107 commented 6 days ago

this curl command using the same hostname/username/pwd works fine: curl --location -k -u "admin":"xxx" "https://dev195580.service-now.com/api/now/table/cmdb_ci_computer?sysparm_fields=sys_id" -o out.json

tupyy commented 5 days ago

Please format the output and post the your playbook.

adn1107 commented 5 days ago
- name: Change incident state
      servicenow.itsm.incident:
        instance:
          host: "{{ sn_hostname }}"
          username: "{{ sn_username }}"
          password: "{{ sn_pwd }}"
          validate_certs: false
        number: "{{ incident_number }}"
        # Common parameters
        state: in_progress
        impact: high
        urgency: high

output:

The full traceback is:
  File "/tmp/ansible_servicenow.itsm.incident_payload_gmjyvghz/ansible_servicenow.itsm.incident_payload.zip/ansible_collections/servicenow/itsm/plugins/modules/incident.py", line 339, in main
  File "/tmp/ansible_servicenow.itsm.incident_payload_gmjyvghz/ansible_servicenow.itsm.incident_payload.zip/ansible_collections/servicenow/itsm/plugins/modules/incident.py", line 285, in run
  File "/tmp/ansible_servicenow.itsm.incident_payload_gmjyvghz/ansible_servicenow.itsm.incident_payload.zip/ansible_collections/servicenow/itsm/plugins/modules/incident.py", line 253, in ensure_present
  File "/tmp/ansible_servicenow.itsm.incident_payload_gmjyvghz/ansible_servicenow.itsm.incident_payload.zip/ansible_collections/servicenow/itsm/plugins/module_utils/table.py", line 28, in get_record
    return self.get(self.path(table), query, must_exist)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/ansible_servicenow.itsm.incident_payload_gmjyvghz/ansible_servicenow.itsm.incident_payload.zip/ansible_collections/servicenow/itsm/plugins/module_utils/snow.py", line 49, in get
    records = self.list(api_path, query)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/ansible_servicenow.itsm.incident_payload_gmjyvghz/ansible_servicenow.itsm.incident_payload.zip/ansible_collections/servicenow/itsm/plugins/module_utils/snow.py", line 28, in list
    response = self.client.get(
               ^^^^^^^^^^^^^^^^
  File "/tmp/ansible_servicenow.itsm.incident_payload_gmjyvghz/ansible_servicenow.itsm.incident_payload.zip/ansible_collections/servicenow/itsm/plugins/module_utils/client.py", line 198, in get
    resp = self.request("GET", path, query=query)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/ansible_servicenow.itsm.incident_payload_gmjyvghz/ansible_servicenow.itsm.incident_payload.zip/ansible_collections/servicenow/itsm/plugins/module_utils/client.py", line 195, in request
    return self._request(method, url, data=data, headers=headers)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/ansible_servicenow.itsm.incident_payload_gmjyvghz/ansible_servicenow.itsm.incident_payload.zip/ansible_collections/servicenow/itsm/plugins/module_utils/client.py", line 161, in _request
    raise ServiceNowError(e.reason)
fatal: [zos_host]: FAILED! => {
    "changed": false,
    "invocation": {
        "module_args": {
            "attachments": null,
            "caller": null,
            "close_code": null,
            "close_notes": null,
            "description": null,
            "hold_reason": null,
            "impact": "high",
            "incident_mapping": null,
            "instance": {
                "access_token": null,
                "api_path": "api/now",
                "client_id": null,
                "client_secret": null,
                "custom_headers": null,
                "grant_type": null,
                "host": "https://dev195580.service-now.com",
                "password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
                "refresh_token": null,
                "timeout": null,
                "username": "admin",
                "validate_certs": false
            },
            "number": "INC0013556",
            "other": null,
            "short_description": null,
            "state": "in_progress",
            "sys_id": null,
            "urgency": "high"
        }
    },
    "msg": "[Errno 1] EDC9501I The name does not resolve for the supplied parameters."
}
adn1107 commented 5 days ago

I added delegate_to: localhost to my playbook and it works ok. I guess the managed node couldn't connect to my ServiceNow instance.