我使用 Redhat Certified Servicenow.itsm 集合使用以下 ansible 任务从 RHEL 主机创建新事件,并且 我能够成功创建事件。从 RHEL Linux 节点但在作为作业模板执行时不能从 AAP 创建。
---
- block:
- name: Create new incident
servicenow.itsm.incident:
instance:
host: "{{ SN_HOST }}"
username: "{{ SN_USERNAME }}"
password: "{{ SN_PASSWORD }}"
validate_certs: no
state: new
description: "Windows health status check through Ansible Automation Platform"
short_description: "Windows Health check status"
other:
u_impacted_user: "{{ SN_USERNAME }}"
contact_type: "{{contact_type}}"
category: "{{category}}"
subcategory: "{{ subcategory }}"
assignment_group: "{{ assignment_group}}"
u_impacted_location: "{{ u_impacted_location }}"
company: "{{company}}"
u_impacted_op_co: "{{ u_impacted_op_co }}"
cmdb_ci: "windows"
work_notes: "New Incident created through Ansible Automation Platform"
caller_id: "{{ SN_USERNAME }}"
u_impact: 3
u_urgency: 4
register: new_incident
- name: Display the SNOW incident "{{ new_incident['record']['number']}}" status after created.
debug:
msg:
- "Incident created is: {{ new_incident['record']['number']}}"
- "Incident state is: {{ new_incident.record.state}} "
tags: create_incident
run_once: yes
delegate_to: localhost
当我将相同的代码上传到REDHAT Ansible自动化平台并执行时,我收到如下错误
任何人都可以帮我解决这个问题的原因吗?
请参阅作业模板在 AAP 中使用设置为 3 的详细程度执行上述任务时的错误消息
完整的回溯是: 文件“/tmp/ansible_servicenow.itsm.incident_payload_ovwltnyb/ansible_servicenow.itsm.incident_payload.zip/ansible_collections/servicenow/itsm/plugins/modules/incident.py”,第 347 行,位于 main 中 文件“/tmp/ansible_servicenow.itsm.incident_payload_ovwltnyb/ansible_servicenow.itsm.incident_payload.zip/ansible_collections/servicenow/itsm/plugins/modules/incident.py”,第 284 行,运行中 文件“/tmp/ansible_servicenow.itsm.incident_payload_ovwltnyb/ansible_servicenow.itsm.incident_payload.zip/ansible_collections/servicenow/itsm/plugins/modules/incident.py”,第235行,位于ensure_present 文件“/tmp/ansible_servicenow.itsm.incident_payload_ovwltnyb/ansible_servicenow.itsm.incident_payload.zip/ansible_collections/servicenow/itsm/plugins/module_utils/table.py”,第 77 行,在 create_record 中 返回 self.client.post(_path(表), Payload, query=_query(query)).json[ 文件“/tmp/ansible_servicenow.itsm.incident_payload_ov…
我什么也没做,但突然间,代码开始工作了