Closed adn1107 closed 5 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
Please format the output and post the your playbook.
- 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."
}
I added delegate_to: localhost
to my playbook and it works ok. I guess the managed node couldn't connect to my ServiceNow instance.
What is my problem please? Can't find anything with Google.