# Error "Failed to connect to the host via ssh: PLEASE HELP

**URL:** <https://forum.ansible.com/t/error-failed-to-connect-to-the-host-via-ssh-please-help/35550>\
**Category:** Ansible Project\
**Tags:** awx\
**Created:** [July 27, 2021, 12:41pm UTC](https://forum.ansible.com/t/error-failed-to-connect-to-the-host-via-ssh-please-help/35550 "2021-07-27T12:41:12Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![user98](https://avatars.discourse-cdn.com/v4/letter/u/ec9cab/32.png) [@user98](https://forum.ansible.com/u/user98)\
**Post date:** [July 27, 2021, 12:41pm UTC](https://forum.ansible.com/t/error-failed-to-connect-to-the-host-via-ssh-please-help/35550/1 "2021-07-27T12:41:12Z")

</div>

Good afternoon, colleagues. I’m trying to run the software version check playbook on the switch. But when I try to connect via ssh, I get the error "Failed to connect to the host via ssh:  
sh-4.4# ansible-playbook show\_version.yml

PLAY [Showversion] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

TASK [Showversion] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
fatal: [10.0.0.1]: UNREACHABLE! =\> {“changed”: false, “msg”: “Failed to connect to the host via ssh: \r\n\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\r\nLANTRACE\r\nWARNING - MONITORED ACTIONS AND ACCESSES \r\nDATANET\r\n\r\n\r\nStation’s information:\r\nZavokzalna\_7a\_str\_p.2\_Boryspil\r\n\r\n - \r\nFloor / Row / Rack / Sub-Rack\r\n / / / \r\nDC power supply:\r\nPower Source A: Floor / Row / Rack / Electrical circuit\r\n / / / \r\n\r\n\r\nNumber of LP: \r\nPosition MUX: \r\nIP LAN: \r\nNote: \r\n\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\r\nShared connection to 10.0.0.1 closed.”, “unreachable”: true}

PLAY RECAP \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
10.0.0.1 : ok=0 changed=0 unreachable=1 failed=0 skipped=0 rescued=0 ignored=0

When executing a playbook with the -vvv switch, I get the following result:  
sh-4.4# ansible-playbook show\_version.yml -vvv  
ansible-playbook 2.9.18  
config file = /etc/ansible/ansible.cfg  
configured module search path = [‘/var/lib/awx/.ansible/plugins/modules’, ‘/usr/share/ansible/plugins/modules’]  
ansible python module location = /usr/lib/python3.6/site-packages/ansible  
executable location = /usr/bin/ansible-playbook  
python version = 3.6.8 (default, Aug 24 2020, 17:57:11) [GCC 8.3.1 20191121 (Red Hat 8.3.1-5)]  
Using /etc/ansible/ansible.cfg as config file  
host\_list declined parsing /etc/ansible/hosts as it did not pass its verify\_file() method  
script declined parsing /etc/ansible/hosts as it did not pass its verify\_file() method  
auto declined parsing /etc/ansible/hosts as it did not pass its verify\_file() method  
Parsed /etc/ansible/hosts inventory source with ini plugin  
Skipping callback ‘actionable’, as we already have a stdout callback.  
Skipping callback ‘counter\_enabled’, as we already have a stdout callback.  
Skipping callback ‘debug’, as we already have a stdout callback.  
Skipping callback ‘dense’, as we already have a stdout callback.  
Skipping callback ‘dense’, as we already have a stdout callback.  
Skipping callback ‘full\_skip’, as we already have a stdout callback.  
Skipping callback ‘json’, as we already have a stdout callback.  
Skipping callback ‘minimal’, as we already have a stdout callback.  
Skipping callback ‘null’, as we already have a stdout callback.  
Skipping callback ‘oneline’, as we already have a stdout callback.  
Skipping callback ‘selective’, as we already have a stdout callback.  
Skipping callback ‘skippy’, as we already have a stdout callback.  
Skipping callback ‘stderr’, as we already have a stdout callback.  
Skipping callback ‘unixy’, as we already have a stdout callback.  
Skipping callback ‘yaml’, as we already have a stdout callback.

PLAYBOOK: show\_version.yml \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
1 plays in show\_version.yml

PLAY [Showversion] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
META: ran handlers

TASK [Showversion] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
task path: /var/lib/awx/projects/show\_version/show\_version.yml:8  
\<10.0.0.1\> ESTABLISH SSH CONNECTION FOR USER: asoxx  
\<10.0.0.1\> SSH: EXEC sshpass -d9 ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o ‘User=“asoxx”’ -o ConnectTimeout=10 -o ControlPath=/var/lib/awx/.ansible/cp/a075732807 -tt 10.0.0.1 ‘show version’  
\<10.0.0.1\> (255, b’', b"\r\n\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\r\nLANTRACE\r\nWARNING - MONITORED ACTIONS AND ACCESSES \r\nDATANET\r\n\r\n\r\nStation’s information:\r\nZavokzalna\_7a\_str\_p.2\_Boryspil\r\n\r\n - \r\nFloor / Row / Rack / Sub-Rack\r\n / / / \r\nDC power supply:\r\nPower Source A: Floor / Row / Rack / Electrical circuit\r\n / / / \r\n\r\n\r\nNumber of LP: \r\nPosition MUX: \r\nIP LAN: \r\nNote: \r\n\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\r\nShared connection to 10.0.0.1 closed.\r\n")  
fatal: [10.0.0.1]: UNREACHABLE! =\> {  
“changed”: false,  
“msg”: “Failed to connect to the host via ssh: \r\n\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\r\nLANTRACE\r\nWARNING - MONITORED ACTIONS AND ACCESSES \r\nDATANET\r\n\r\n\r\nStation’s information:\r\nZavokzalna\_7a\_str\_p.2\_Boryspil\r\n\r\n - \r\nFloor / Row / Rack / Sub-Rack\r\n / / / \r\nDC power supply:\r\nPower Source A: Floor / Row / Rack / Electrical circuit\r\n / / / \r\n\r\n\r\nNumber of LP: \r\nPosition MUX: \r\nIP LAN: \r\nNote: \r\n\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\r\nShared connection to 10.0.0.1 closed.”,  
“unreachable”: true  
}

PLAY RECAP \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
10.0.0.1 : ok=0 changed=0 unreachable=1 failed=0 skipped=0 rescued=0 ignored=0

$ ansible --version ansible [core 2.11.2] config file = /etc/ansible/ansible.cfg configured module search path = [‘/root/.ansible/plugins/modules’, ‘/usr/share/ansible/plugins/modules’] ansible python module location = /usr/local/lib/python3.7/dist-packages/ansible ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections executable location = /usr/local/bin/ansible python version = 3.7.3 (default, Jan 22 2021, 20:04:44) [GCC 8.3.0] jinja version = 3.0.1 libyaml = True

$ ansible-config dump --only-changed ANSIBLE\_SSH\_ARGS(/etc/ansible/ansible.cfg) = -C -o ControlMaster=auto -o ControlPersist=60s HOST\_KEY\_CHECKING(/etc/ansible/ansible.cfg) = False

I expected the output to be like this:  
sh-4.4# ansible-playbook show\_version.yml

PLAY [Showversion] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

TASK [Showversion] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
sw0-ap#show version  
Unit 1  
Serial Number: 406000938  
Hardware Version: R01  
Chip Device ID: Marvell 98DX106-B0, 88E6095[F]  
EPLD Version: 0.07  
Number of Ports: 28  
Main Power Status: Up  
Redundant Power Status: Not present

Agent (Master)  
Unit ID: 1  
Loader Version: 1.0.4.1  
Boot ROM Version: 1.2.1.3  
Operation Code Version: 1.4.20.32

PLAY RECAP \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
10.254.18.27 : ok=0 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0

Actual Results

sh-4.4# ansible-playbook show\_version.yml PLAY [Showversion] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* TASK [Showversion] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* fatal: [10.0.0.1]: UNREACHABLE! =\> {“changed”: false, “msg”: “Failed to connect to the host via ssh: \r\n\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\r\nLANTRACE\r\nWARNING - MONITORED ACTIONS AND ACCESSES \r\nDATANET\r\n\r\n\r\nStation’s information:\r\nZavokzalna\_7a\_str\_p.2\_Boryspil\r\n\r\n - \r\nFloor / Row / Rack / Sub-Rack\r\n / / / \r\nDC power supply:\r\nPower Source A: Floor / Row / Rack / Electrical circuit\r\n / / / \r\n\r\n\r\nNumber of LP: \r\nPosition MUX: \r\nIP LAN: \r\nNote: \r\n\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\r\nShared connection to 10.0.0.1 closed.”, “unreachable”: true} PLAY RECAP \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* 10.0.0.1 : ok=0 changed=0 unreachable=1 failed=0 skipped=0 rescued=0 ignored=0
