# Ansible 2.3.0 Connecting to Cisco IOS router

**URL:** <https://forum.ansible.com/t/ansible-2-3-0-connecting-to-cisco-ios-router/24767>\
**Category:** Ansible Project\
**Tags:** windows\
**Created:** [June 19, 2017, 11:26pm UTC](https://forum.ansible.com/t/ansible-2-3-0-connecting-to-cisco-ios-router/24767 "2017-06-19T23:26:47Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Patrick\_Matheny](https://avatars.discourse-cdn.com/v4/letter/p/848f3c/32.png) [@Patrick\_Matheny](https://forum.ansible.com/u/Patrick_Matheny)\
**Post date:** [June 19, 2017, 11:26pm UTC](https://forum.ansible.com/t/ansible-2-3-0-connecting-to-cisco-ios-router/24767/1 "2017-06-19T23:26:47Z")

</div>

I’m very new to Ansible. I have a small lab running and I’m trying to evaluate the use of Ansible for making network changes. I have a workstations running CentOS Linux release 7.3.1611 and Ansible 2.3.0 as a fresh install. I’m using a cisco 819 router running Cisco IOS Software, C800 Software (C800-UNIVERSALK9-M), Version 15.3(3)M.3. I can SSH from the workstation to the router from the work station and via putty on a windows 10 machine but when I try a connection test I get the following:

[pat@new-host-8 ~]$ansible all -m ping  
192.168.1.142 | UNREACHABLE! =\> {  
“changed”: false,  
“msg”: “Failed to connect to the host via ssh: Connection closed\r\n”,  
“unreachable”: true  
}

I’ve run multiple debugs. Can anyone make a suggestion on what the issue might be? I’ve done some research and have run a number of raw commands as well as a small playbook it appears to not be an SSH error but an issue within an Ansible module with sleep 0 command…

Regards

Pat

Testing SSH terminal session from Ansible host system to the router

[pat@new-host-8 ~]$ ssh 192.168.1.142 -l pat

819#

---

<div class="post-metadata">

**Author:** ![Kai\_Stian\_Olstad](https://avatars.discourse-cdn.com/v4/letter/k/e19adc/32.png) [@Kai\_Stian\_Olstad](https://forum.ansible.com/u/Kai_Stian_Olstad)\
**Post date:** [June 22, 2017, 6:55am UTC](https://forum.ansible.com/t/ansible-2-3-0-connecting-to-cisco-ios-router/24767/2 "2017-06-22T06:55:40Z")

</div>

To run ansible on remote host the host need to support Python.  
When using the ping module Ansible creates a little Python script that is copied to the remote and then runs the python script on the remote host.  
But network equipment typically doesn't support Python.

Ansible has support for Cisco, the iso\_\* modules.  
These modules are running on the Ansible control machine and do a ssh to the Cisco and runs the appropriate commands on the cli.

---

<div class="post-metadata">

**Author:** ![ganeshrn](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/ganeshrn/32/1021_2.png) [@ganeshrn](https://forum.ansible.com/u/ganeshrn)\
**Post date:** [June 22, 2017, 8:30am UTC](https://forum.ansible.com/t/ansible-2-3-0-connecting-to-cisco-ios-router/24767/3 "2017-06-22T08:30:25Z")

</div>

You need to mention connection type local for network devices.

```auto
---
- hosts: lab
  connection: local

```

The credentials to connect to remote network device can be mentioned either in playbook within a [provider](https://docs.ansible.com/ansible/ios_command_module.html) or in [host inventory](http://docs.ansible.com/ansible/intro_inventory.html) file.

Regards,  
Ganesh
