# Ansible can't access my network devices. Getting :    FAILED! =\> {"changed": false, "msg": "Connection type ssh is not valid for this module"}

**URL:** <https://forum.ansible.com/t/ansible-cant-access-my-network-devices-getting-failed-changed-false-msg-connection-type-ssh-is-not-valid-for-this-module/31657>\
**Category:** Ansible Project\
**Created:** [November 14, 2019, 4:35am UTC](https://forum.ansible.com/t/ansible-cant-access-my-network-devices-getting-failed-changed-false-msg-connection-type-ssh-is-not-valid-for-this-module/31657 "2019-11-14T04:35:32Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Palmer](https://avatars.discourse-cdn.com/v4/letter/p/d78d45/32.png) [@Palmer](https://forum.ansible.com/u/Palmer)\
**Post date:** [November 14, 2019, 4:35am UTC](https://forum.ansible.com/t/ansible-cant-access-my-network-devices-getting-failed-changed-false-msg-connection-type-ssh-is-not-valid-for-this-module/31657/1 "2019-11-14T04:35:32Z")

</div>

Hi,

I’m new to Ansible and trying to write my first playbook.

But i keep getting an error: **fatal: [RTR1]: FAILED! =\> {“changed”: false, “msg”: “Connection type ssh is not valid for this module”}**

I’m suspecting Ansible is complaining about my Cisco devices ssh settings (running diffie-hellman-group1-sha1) but I’m not sure if that’s correct. Will appreciate your assistance

 ![anserror.JPG](https://us1.discourse-cdn.com/ansible/original/2X/2/2fefc9eb4f4988d54e194c4c61459fe0f2d49dbf.jpeg)

---

<div class="post-metadata">

**Author:** ![nchakrab](https://avatars.discourse-cdn.com/v4/letter/n/919ad9/32.png) [@nchakrab](https://forum.ansible.com/u/nchakrab)\
**Post date:** [November 14, 2019, 5:10am UTC](https://forum.ansible.com/t/ansible-cant-access-my-network-devices-getting-failed-changed-false-msg-connection-type-ssh-is-not-valid-for-this-module/31657/2 "2019-11-14T05:10:11Z")

</div>

Hello,

You need to use ansible\_connection=network\_cli. This connection plugin provides a connection to remote devices over the SSH and implements a CLI shell. It is typically used by network devices for sending CLI commands to network devices and also receiving information from them. If your devices are running Cisco IOS, please have a look at the [platform guide](https://docs.ansible.com/ansible/latest/network/user_guide/platform_ios.html).

You can also refer to [https://docs.ansible.com/ansible/latest/network/index.html](https://docs.ansible.com/ansible/latest/network/index.html) for more information on getting started with Ansible Network Automation.

Thank you!

> **(attachments)**
>
> ![anserror.JPG](https://us1.discourse-cdn.com/ansible/original/2X/2/2fefc9eb4f4988d54e194c4c61459fe0f2d49dbf.jpeg)

---

<div class="post-metadata">

**Author:** ![sdoran](https://avatars.discourse-cdn.com/v4/letter/s/47e85d/32.png) [@sdoran](https://forum.ansible.com/u/sdoran)\
**Post date:** [November 14, 2019, 3:19pm UTC](https://forum.ansible.com/t/ansible-cant-access-my-network-devices-getting-failed-changed-false-msg-connection-type-ssh-is-not-valid-for-this-module/31657/3 "2019-11-14T15:19:11Z")

</div>

Palmer,

When connecting to network devices, you need to specify an [appropriate connection plugin](https://docs.ansible.com/ansible/latest/network/getting_started/network_differences.html#using-become-for-privilege-escalation), such as network\_cli, and [specify the network OS](https://docs.ansible.com/ansible/latest/network/getting_started/network_differences.html#using-become-for-privilege-escalation) in inventory.

---

<div class="post-metadata">

**Author:** ![Palmer](https://avatars.discourse-cdn.com/v4/letter/p/d78d45/32.png) [@Palmer](https://forum.ansible.com/u/Palmer)\
**Post date:** [November 15, 2019, 3:58am UTC](https://forum.ansible.com/t/ansible-cant-access-my-network-devices-getting-failed-changed-false-msg-connection-type-ssh-is-not-valid-for-this-module/31657/4 "2019-11-15T03:58:23Z")

</div>

Thanks for the input. I did try what you suggested but I’m here the same issue. Please take a look at the screenshot and let me know if you see something

 ![ansserror.JPG](https://us1.discourse-cdn.com/ansible/original/2X/9/93376c25742a41254ecb078a7a9f0edf8ec1e614.jpeg)

---

<div class="post-metadata">

**Author:** ![Scott\_Fella](https://avatars.discourse-cdn.com/v4/letter/s/aeb1de/32.png) [@Scott\_Fella](https://forum.ansible.com/u/Scott_Fella)\
**Post date:** [November 15, 2019, 5:36am UTC](https://forum.ansible.com/t/ansible-cant-access-my-network-devices-getting-failed-changed-false-msg-connection-type-ssh-is-not-valid-for-this-module/31657/5 "2019-11-15T05:36:59Z")

</div>

I’m pretty new to and ran into the same issue. Is your hosts file defined like this:

[ios]  
RTR1  
RTR2

Did you define something in your config.yml?

---

<div class="post-metadata">

**Author:** ![Palmer](https://avatars.discourse-cdn.com/v4/letter/p/d78d45/32.png) [@Palmer](https://forum.ansible.com/u/Palmer)\
**Post date:** [November 15, 2019, 1:20pm UTC](https://forum.ansible.com/t/ansible-cant-access-my-network-devices-getting-failed-changed-false-msg-connection-type-ssh-is-not-valid-for-this-module/31657/6 "2019-11-15T13:20:26Z")

</div>

Here is what i have defined/configured in hosts and config.yml files:

 ![anssserror.JPG](https://us1.discourse-cdn.com/ansible/original/2X/6/6e7796ce850388419a882d7df939a7489f045a72.jpeg)

---

<div class="post-metadata">

**Author:** ![nchakrab](https://avatars.discourse-cdn.com/v4/letter/n/919ad9/32.png) [@nchakrab](https://forum.ansible.com/u/nchakrab)\
**Post date:** [November 15, 2019, 2:12pm UTC](https://forum.ansible.com/t/ansible-cant-access-my-network-devices-getting-failed-changed-false-msg-connection-type-ssh-is-not-valid-for-this-module/31657/7 "2019-11-15T14:12:02Z")

</div>

I see that the group name in inventory is “Cisco\_Router”, however, the group\_vars file is named as “ios.yaml”. Those two should be identical in this approach.

Please have a look at [https://docs.ansible.com/ansible/latest/user\_guide/intro\_inventory.html#organizing-host-and-group-variables](https://docs.ansible.com/ansible/latest/user_guide/intro_inventory.html#organizing-host-and-group-variables).

Thanks!

> **(attachments)**
>
> ![anssserror.JPG](https://us1.discourse-cdn.com/ansible/original/2X/6/6e7796ce850388419a882d7df939a7489f045a72.jpeg)

---

<div class="post-metadata">

**Author:** ![Scott\_Fella](https://avatars.discourse-cdn.com/v4/letter/s/aeb1de/32.png) [@Scott\_Fella](https://forum.ansible.com/u/Scott_Fella)\
**Post date:** [November 15, 2019, 2:14pm UTC](https://forum.ansible.com/t/ansible-cant-access-my-network-devices-getting-failed-changed-false-msg-connection-type-ssh-is-not-valid-for-this-module/31657/8 "2019-11-15T14:14:20Z")

</div>

Your group\_vars yml file should be named identical to the group-name you put your device(s). This is why the variables are not being called. If you define these in your playbook it would work and that can help later isolate where things are not working.

---

<div class="post-metadata">

**Author:** ![Palmer](https://avatars.discourse-cdn.com/v4/letter/p/d78d45/32.png) [@Palmer](https://forum.ansible.com/u/Palmer)\
**Post date:** [November 15, 2019, 10:22pm UTC](https://forum.ansible.com/t/ansible-cant-access-my-network-devices-getting-failed-changed-false-msg-connection-type-ssh-is-not-valid-for-this-module/31657/9 "2019-11-15T22:22:06Z")

</div>

Thank you everyone for your help on this. This issue has been resolved. As you previously mentioned, I made sure the group\_vars yml file was named identical with the group-name i have my devices

---

<div class="post-metadata">

**Author:** ![Franz\_Ford\_Decrito](https://avatars.discourse-cdn.com/v4/letter/f/54ee81/32.png) [@Franz\_Ford\_Decrito](https://forum.ansible.com/u/Franz_Ford_Decrito)\
**Post date:** [May 11, 2020, 8:53pm UTC](https://forum.ansible.com/t/ansible-cant-access-my-network-devices-getting-failed-changed-false-msg-connection-type-ssh-is-not-valid-for-this-module/31657/10 "2020-05-11T20:53:30Z")

</div>

Try adding the “ **connection:local** ” under your hosts

- hosts: “myhost”

connection: local
