ansible / ansible

Ansible is a radically simple IT automation platform that makes your applications and systems easier to deploy and maintain. Automate everything from code deployment to network configuration to cloud management, in a language that approaches plain English, using SSH, with no agents to install on remote systems. https://docs.ansible.com.
https://www.ansible.com/
GNU General Public License v3.0
62.28k stars 23.79k forks source link

ansible.module_utils.connection.ConnectionError: timeout trying to send command: #44389

Closed Wo0dsi3 closed 5 years ago

Wo0dsi3 commented 6 years ago
SUMMARY

New to using Ansible. Hope I am logging this issue to the right place. If not , apologies. Running a playbook so as to update configutations on network devices. Playbook references a jinga file so as to load modules which are blocks of IOS code This playbook fails intermittely at different points with the error included above. The playbook runs succesfully the very odd time.

ISSUE TYPE
COMPONENT NAME

ios_config

ANSIBLE VERSION
btadmin@STLPBTDC0693:/etc/ansible$ ansible --version
ansible 2.6.0
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/home/btadmin/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python2.7/dist-packages/ansible-2.6.0-py2.7.egg/ansible
  executable location = /usr/local/bin/ansible
  python version = 2.7.15rc1 (default, Apr 15 2018, 21:51:34) [GCC 7.3.0]
CONFIGURATION

btadmin@STLPBTDC0693:/etc/ansible$ ansible-config dump --only-changed DEFAULT_ASK_PASS(/etc/ansible/ansible.cfg) = True HOST_KEY_CHECKING(/etc/ansible/ansible.cfg) = False PARAMIKO_LOOK_FOR_KEYS(/etc/ansible/ansible.cfg) = False

OS / ENVIRONMENT

btadmin@STLPBTDC0693:/etc/ansible$ lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 18.04.1 LTS Release: 18.04 Codename: bionic

STEPS TO REPRODUCE
---
- name: Security Audit - Gather facts
  hosts: all
  gather_facts: no
  connection: local
  tasks:
   - name: Create Output Directory
     file:
      path: ./Output/{{ sitecode }}
      state: directory
     run_once: true
   - name: Get Device Facts
     register: iosfacts_out
     ios_facts:
      gather_subset: all
   - copy: content="{{ iosfacts_out | to_nice_json }}" dest="./Output/{{ sitecode }}/{{ inventory_hostname }}.fct"
- name: Security Configurations
  hosts: MPLS
  gather_facts: no
  connection: local
  tasks:
    - name: Push to MPLS
      ios_config:
        src: "./templates/MPLS-main.conf"
        save_when: modified
- name: Push to DMVPN
  hosts: DMVPN
  gather_facts: no
  connection: local
  tasks:
     - name: Push to DMVPN
       ios_config:
         src: "./templates/DMVPN-main.conf"
         save_when: modified
- name: Push to SW
  hosts: CORE
  gather_facts: no
  connection: local
  tasks:
     - name: Push to SW
       ios_config:
        src: "./templates/SW-main.conf"
        save_when: modified
EXPECTED RESULTS

The following modules to be run succesfully btadmin@STLPBTDC0693:/etc/ansible/templates$ more MPLS-main.conf {% include 'Glan-SNMPv3.conf' %} {% include 'RTR-SSH.conf' %} {% include 'RTR-VTY.conf' %}

btadmin@STLPBTDC0693:/etc/ansible/templates$ more Glan-SNMPv3.conf ! ip access-list standard BT-MGMT-ACL permit 10.106.110.10 permit 10.160.2.184 permit 10.24.160.164 permit 10.20.136.181 permit 10.160.2.141 permit 10.106.102.79 permit 10.160.15.254 permit 10.20.150.10 permit 10.167.2.225 permit 10.254.111.0 0.0.0.255 deny any log ! snmp-server group BTSNMP-RO v3 auth read full-mib write none access BT-MGMT-ACL snmp-server group BTSNMP-RW v3 priv read full-mib write full-mib access BT-MGMT-ACL snmp-server user BTSNMP-USER BTSNMP-RW v3 auth sha c1sc0123 priv des c1sc0123 snmp-server user GLANSNMP-SMARTNET BTSNMP-RW v3 auth md5 *agTYh&6 priv aes 256 %$#dftg1 access BT-MGMT-ACL snmp-server view inventory-mib internet included snmp-server view none iso excluded snmp-server view full-mib internet included snmp-server view v1default iso excluded snmp-server enable traps snmp authentication linkdown linkup coldstart warmstart snmp-server enable traps cpu threshold btadmin@STLPBTDC0693:/etc/ansible/templates$ more RTR-SSH.conf ! ip ssh version 2 ! ip access-list standard SSH-ACL remark ### VTY Access ### permit 10.0.0.0 0.255.255.255 log permit 192.168.0.0 0.0.255.255 log deny any log ! line con 0 login authentication default ! btadmin@STLPBTDC0693:/etc/ansible/templates$ more RTR-VTY.conf ! line vty 0 4 transport input ssh transport output none access-class SSH-ACL in vrf-also login authentication default session-timeout 10 exec-timeout 10 0 ! line vty 5 15 transport input none transport output none

ACTUAL RESULTS

The full traceback is: Traceback (most recent call last): File "/tmp/ansible_egeidy/ansible_module_ios_config.py", line 560, in main() File "/tmp/ansible_egeidy/ansible_module_ios_config.py", line 489, in main load_config(module, commands) File "/tmp/ansible_egeidy/ansible_modlib.zip/ansible/module_utils/network/ios/ios.py", line 162, in load_config File "/tmp/ansible_egeidy/ansible_modlib.zip/ansible/module_utils/connection.py", line 149, in rpc ansible.module_utils.connection.ConnectionError: timeout trying to send command: login authentication default

fatal: [MPLS]: FAILED! => { "changed": false, "module_stderr": "Traceback (most recent call last):\n File \"/tmp/ansible_egeidy/ansible_module_ios_config.py\", line 560, in \n main()\n File \"/tmp/ansible_egeidy/ansible_module_ios_config.py\", line 489, in main\n load_config(module, commands)\n File \"/tmp/ansible_egeidy/ansible_modlib.zip/ansible/module_utils/network/ios/ios.py\", line 162, in load_config\n File \"/tmp/ansible_egeidy/ansible_modlib.zip/ansible/module_utils/connection.py\", line 149, in rpc\nansible.module_utils.connection.ConnectionError: timeout trying to send command: login authentication default\n", "module_stdout": "", "msg": "MODULE FAILURE", "rc": 1

ansibot commented 6 years ago

Files identified in the description:

If these files are inaccurate, please update the component name section of the description or use the !component bot command.

click here for bot help

ansibot commented 6 years ago

cc @dpassante @privateip @rcarrillocruz @resmo click here for bot help

ansibot commented 6 years ago

Hi @Wo0dsi3,

Thank you for the issue, just so you are aware we have a dedicated Working Group for network. You can find other people interested in this in #ansible-network on Freenode IRC For more information about communities, meetings and agendas see https://github.com/ansible/community

click here for bot help

resmo commented 6 years ago

!component lib/ansible/modules/cloud/cloudstack/cs_configuration.py

Wo0dsi3 commented 6 years ago

Hi Rene,

Thank you very much for the reply.

Sry, I am not sure what I need to do.. I have lack of experience in Linux/python/ansible.. I am learning, but slowly! I couldn’t find a description of what I need to remove/change/amend on the site.

Do I need to remove/amend this file ?

!component lib/ansible/modules/cloud/cloudstack/cs_configuration.py

Thanks,

Donnchadh Woods Network Engineer Managed Customer Service BT Business & Public Sector

From: René Moser [mailto:notifications@github.com] Sent: 20 August 2018 13:45 To: ansible/ansible ansible@noreply.github.com Cc: Woods,D,Donnchadh,HQO11 R donnchadh.woods@bt.com; Mention mention@noreply.github.com Subject: Re: [ansible/ansible] ansible.module_utils.connection.ConnectionError: timeout trying to send command: (#44389)

!component lib/ansible/modules/cloud/cloudstack/cs_configuration.py

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/ansible/ansible/issues/44389#issuecomment-414303763, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AfnRy3IAYf4Tb8CT1BlxzSDLEyf8cMsOks5uSq9WgaJpZM4WDyxb.

Wo0dsi3 commented 6 years ago

Hi Rene,

Any help or guidance here would be greatly appreciated.

Regards

Donnchadh Woods Network Engineer Managed Customer Service BT Business & Public Sector

From: Woods,D,Donnchadh,HQO11 R Sent: 20 August 2018 23:11 To: 'ansible/ansible' reply@reply.github.com; ansible/ansible ansible@noreply.github.com Cc: Mention mention@noreply.github.com Subject: RE: [ansible/ansible] ansible.module_utils.connection.ConnectionError: timeout trying to send command: (#44389)

Hi Rene,

Thank you very much for the reply.

Sry, I am not sure what I need to do.. I have lack of experience in Linux/python/ansible.. I am learning, but slowly! I couldn’t find a description of what I need to remove/change/amend on the site.

Do I need to remove/amend this file ?

!component lib/ansible/modules/cloud/cloudstack/cs_configuration.py

Thanks,

Donnchadh Woods Network Engineer Managed Customer Service BT Business & Public Sector

From: René Moser [mailto:notifications@github.com] Sent: 20 August 2018 13:45 To: ansible/ansible ansible@noreply.github.com<mailto:ansible@noreply.github.com> Cc: Woods,D,Donnchadh,HQO11 R donnchadh.woods@bt.com<mailto:donnchadh.woods@bt.com>; Mention mention@noreply.github.com<mailto:mention@noreply.github.com> Subject: Re: [ansible/ansible] ansible.module_utils.connection.ConnectionError: timeout trying to send command: (#44389)

!component lib/ansible/modules/cloud/cloudstack/cs_configuration.py

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/ansible/ansible/issues/44389#issuecomment-414303763, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AfnRy3IAYf4Tb8CT1BlxzSDLEyf8cMsOks5uSq9WgaJpZM4WDyxb.

rcarrillocruz commented 6 years ago

Please try to set ANSIBLE_PERSISTENT_COMMAND_TIMEOUT envvar to a big value, like 300. That setting is what bumps the timeout on persistent connection commands.

rcarrillocruz commented 6 years ago

needs_info

ansibot commented 5 years ago

@Wo0dsi3 This issue is waiting for your response. Please respond or the issue will be closed.

click here for bot help

ansibot commented 5 years ago

cc @rhtyd click here for bot help

rohityadavcloud commented 5 years ago

Sorry does not look like a CloudStack specific issue, I won't be of any help.

ansibot commented 5 years ago

@Wo0dsi3 You have not responded to information requests in this issue so we will assume it no longer affects you. If you are still interested in this, please create a new issue with the requested information.

click here for bot help