这是供您参考的剧本:
---
- name: Closing notes
hosts: XXXX
gather_facts: yes
tasks:
- name: Modify a change request
snow_record:
state: present
table: change_request
username: admin
password: XXXXX
instance: XXXXX
number: XXXXX
data:
state: -3
register: incident
- debug:
var: incident.record.state
输出:
致命:[XXXXXXX]:失败! => { “已更改”:错误, “ module_stderr”:“与XXXXXXX的共享连接已关闭。\ r \ n”, “ module_stdout”:“跟踪(最近一次通话最近):\ r \ n文件\” / home / ansible / .ansible / tmp / ansible-tmp-1577091421.74-160409156883610 / AnsiballZ_snow_record.py \“,第114行,位于\ r \ n _ansiballz_main()\ r \ n文件\“ / home / ansible / .ansible / tmp / ansible-tmp-1577091421.74-160409156883610 / AnsiballZ_snow_record.py \”,第106行,在_ansiballz_main \ r \ n invoke_module(zipped_mod,temp_path ,ANSIBALLZ_PARAMS)\ r \ n文件\“ / home / ansible / .ansible / tmp / ansible-tmp-1577091421.74-160409156883610 / AnsiballZ_snow_record.py \”,第49行,invoke_module \ r \ n imp.load_module(' main ',mod,模块,MOD_DESC)\ r \ n文件\“ / tmp / ansible_snow_record_payload_qHs01F / main .py \”,\ r \ n文件\“中的第334行/ tmp / ansible_snow_record_payload_qHs01F / 主 .py \“,主行中的第330行,” \ t \ n / tmp / ansible_snow_record_payload_qHs01F / 主 .py \”,行319 ,在run_module \ r \ nAttributeError中:'module'对象没有属性'UnexpectedResponse'\ r \ n“, “ msg”:“模块失败\ n请参阅stdout / stderr了解确切错误”, “ rc”:1 }
答案 0 :(得分:0)
需要指定python的环境为python3,就可以解决 需要把Python环境做成Python 3,才能解决这个问题
例如
[全部:变量] ansible_python_interpreter=/usr/bin/python3