0

Here is the playbook for your reference:

---
- 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

Output:

fatal: [XXXXXXX]: FAILED! => { "changed": false, "module_stderr": "Shared connection to XXXXXXX closed.\r\n", "module_stdout": "Traceback (most recent call last):\r\n File \"/home/ansible/.ansible/tmp/ansible-tmp-1577091421.74-160409156883610/AnsiballZ_snow_record.py\", line 114, in \r\n _ansiballz_main()\r\n File \"/home/ansible/.ansible/tmp/ansible-tmp-1577091421.74-160409156883610/AnsiballZ_snow_record.py\", line 106, in _ansiballz_main\r\n invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\r\n File \"/home/ansible/.ansible/tmp/ansible-tmp-1577091421.74-160409156883610/AnsiballZ_snow_record.py\", line 49, in invoke_module\r\n imp.load_module('main', mod, module, MOD_DESC)\r\n File \"/tmp/ansible_snow_record_payload_qHs01F/main.py\", line 334, in \r\n File \"/tmp/ansible_snow_record_payload_qHs01F/main.py\", line 330, in main\r\n File \"/tmp/ansible_snow_record_payload_qHs01F/main.py\", line 319, in run_module\r\nAttributeError: 'module' object has no attribute 'UnexpectedResponse'\r\n", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1 }

jvarela
  • 3,744
  • 1
  • 22
  • 43
  • --- - name: Closing ticket in service now hosts: XXXXX gather_facts: yes tasks: - name: Modify a change request snow_record: state: present table: change_request username: admin password: XXXXXX instance: XXXXXX number: CHG0030002 data: state: -3 register: incident - debug: var: incident.record.state ~ – satish nimmakayalu Dec 23 '19 at 09:21
  • 1
    https://github.com/ansible/ansible/issues/41148 This seems to be an issue/bug in ansible snow_record module – error404 Dec 23 '19 at 10:47

1 Answers1

0

需要指定python的环境为 python3,就可以解决 You need to make the Python environment as Python 3, you can solve this problem

eg

[all:vars] ansible_python_interpreter=/usr/bin/python3

  • Qustion, is the non-english (Chinese maybe?) part of the answer relevant? If yes, can you translate them to English? If not, can you remove them, as they only add noise otherwise? Thanks, – Cristik Mar 01 '21 at 08:13