satish nimmakayalu
satish nimmakayalu

Reputation: 1

How to fix the error 'module' object has no attribute 'UnexpectedResponse' in Ansible playbook

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 }

Upvotes: 0

Views: 4465

Answers (1)

sheng kk kks
sheng kk kks

Reputation: 21

需要指定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

Upvotes: 0

Related Questions