ansible-collections / ansible.netcommon

Ansible Network Collection for Common Code
GNU General Public License v3.0
144 stars 104 forks source link

Socket is closed errors #202

Open janrv opened 3 years ago

janrv commented 3 years ago

I have been experiencing a lot of issues regarding the error: Socket is closed.

<10.248.0.101> EXEC /bin/sh -c 'rm -f -r /var/lib/awx/.ansible/tmp/ansible-local-2204217scxicep8/ansible-tmp-1610100647.0131307-2204280-216849336352314/ > /dev/null 2>&1 && sleep 0'
The full traceback is:
  File "/tmp/ansible_ansible.netcommon.cli_command_payload_8codvpkz/ansible_ansible.netcommon.cli_command_payload.zip/ansible_collections/ansible/netcommon/plugins/modules/cli_command.py", line 170, in main
  File "/tmp/ansible_ansible.netcommon.cli_command_payload_8codvpkz/ansible_ansible.netcommon.cli_command_payload.zip/ansible/module_utils/connection.py", line 185, in __rpc__
    raise ConnectionError(to_text(msg, errors='surrogate_then_replace'), code=code)
fatal: [10.248.0.101]: FAILED! => {
    "changed": false,
    "invocation": {
        "module_args": {
            "answer": null,
            "check_all": false,
            "command": "vsx stat -v | grep CI00056582",
            "newline": true,
            "prompt": null,
            "sendonly": false
        }
    },
    "msg": "Socket is closed"

This seems to occur randomly towards hosts in my inventory and I have no idea how to prevent this from occurring nor do I understand why this is happening.

My task in the playbook:

- name: get VS id of the VS on which the vpn is created
    ansible.netcommon.cli_command:
      command: "vsx stat -v | grep {{vpninfo.json.objects[0].guestofcluster}}"          
    register: outputcommand

I have seen other posts regarding this issue, but no real solution/cause was ever provided

ashish-k-panigrahy commented 12 months ago

I have been seeing this issue too with nxos_config module. I don't know what the cause is and how to solve it. use case/example:


- name: Delete IP block 
  nxos_config:
    lines: "no ip prefix-list PLIST-XX1"
    save_when: always
  register: ip_delete_result
  until: ip_delete_result is succeeded
  retries: 3

Error: fatal: [clf01-r03]: FAILED! => {"attempts": 3, "changed": false, "msg": "Socket is closed"}