Re: [ansible-project] Cisco switch unreachable

2017-07-10 Thread Kai Stian Olstad

On 08. juli 2017 13:17, Phil F wrote:

Hi,

I have just installed Ansible for the first time and am attempting to
connect to a Cisco switch, this needs to be with username and password.

 From both an Ubuntu server and my Mac I can ssh to the box with the same
username and password I have configured in the ansible inventory.

I have attempted from an Ubuntu host and my Mac, however I am receiving the
following error:

===

:/etc/ansible$ ansible -m ping all

 | UNREACHABLE! => {

"changed": false,

"msg": "Failed to connect to the host via ssh: Connection to 192.168.10.200
closed by remote host.\r\nConnection closed\r\n",

"unreachable": true

}


This is one of the more asked and answered question so I just gona give 
you a link.


https://groups.google.com/d/msg/ansible-project/KR1DDD4Avr8/o4lw-YpuAgAJ


--
Kai Stian Olstad

--
You received this message because you are subscribed to the Google Groups "Ansible 
Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/ff47b078-c3cb-6647-4577-2a3b5353b559%40olstad.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Cisco switch unreachable

2017-07-10 Thread Phil F
Hi,

I have just installed Ansible for the first time and am attempting to 
connect to a Cisco switch, this needs to be with username and password.

>From both an Ubuntu server and my Mac I can ssh to the box with the same 
username and password I have configured in the ansible inventory.

I have attempted from an Ubuntu host and my Mac, however I am receiving the 
following error:

===

:/etc/ansible$ ansible -m ping all 

 | UNREACHABLE! => { 

"changed": false, 

"msg": "Failed to connect to the host via ssh: Connection to 192.168.10.200 
closed by remote host.\r\nConnection closed\r\n", 

"unreachable": true 

}

===

Ansible config:

host1 ansible_host=192.168.10.200 ansible_user= ansible_ssh_pass=

Debug from switch shows the succesful authentication and subsequent closing 
of the connection:

*Jul  8 06:20:52.804: SSH2 1: MAC compared for #8 :ok
*Jul  8 06:20:52.804: SSH2 1: input: padlength 37 bytes
*Jul  8 06:20:52.808: SSH2 1: send:packet of  length 16 (length also 
includes padlen of 10)
*Jul  8 06:20:52.808: SSH2 1: computed MAC for sequence no.#8 type 52
*Jul  8 06:20:52.808: SSH2 1: authentication successful for ansibleuser
*Jul  8 06:20:52.814: SSH2 1: ssh_receive: 64 bytes received 
*Jul  8 06:20:52.814: SSH2 1: input: total packet length of 48 bytes
*Jul  8 06:20:52.814: SSH2 1: partial packet length(block size)16 
bytes,needed 32 bytes,
   maclen 16
*Jul  8 06:20:52.814: SSH2 1: MAC compared for #9 :ok
*Jul  8 06:20:52.814: SSH2 1: input: padlength 19 bytes
*Jul  8 06:20:52.814: SSH2 1: channel open request
*Jul  8 06:20:52.815: SSH2 1: send:packet of  length 32 (length also 
includes padlen of 10)
*Jul  8 06:20:52.815: SSH2 1: computed MAC for sequence no.#9 type 91
*Jul  8 06:20:52.818: SSH2 1: ssh_receive: 144 bytes received 
*Jul  8 06:20:52.818: SSH2 1: input: total packet length of 48 bytes
*Jul  8 06:20:52.818: SSH2 1: partial packet length(block size)16 
bytes,needed 32 bytes,
   maclen 16
*Jul  8 06:20:52.818: SSH2 1: MAC compared for #10 :ok
*Jul  8 06:20:52.818: SSH2 1: input: padlength 7 bytes
*Jul  8 06:20:52.818: SSH2 1: env request
*Jul  8 06:20:52.819: SSH2 1: input: total packet length of 64 bytes
*Jul  8 06:20:52.819: SSH2 1: partial packet length(block size)16 
bytes,needed 48 bytes,
   maclen 16
*Jul  8 06:20:52.819: SSH2 1: MAC compared for #11 :ok
*Jul  8 06:20:52.819: SSH2 1: input: padlength 11 bytes
*Jul  8 06:20:52.819: SSH2 1: send:packet of  length 16 (length also 
includes padlen of 6)
*Jul  8 06:20:52.819: SSH2 1: computed MAC for sequence no.#10 type 99
*Jul  8 06:20:52.819: SSH2 1: exec request
*Jul  8 06:20:52.819: SSH2 1: exec message received
*Jul  8 06:20:52.819: SSH2 1: starting shell for vty
*Jul  8 06:20:52.821: SSH2 1: send:packet of  length 96 (length also 
includes padlen of 19)
*Jul  8 06:20:52.821: SSH2 1: computed MAC for sequence no.#11 type 94
*Jul  8 06:20:52.926: SSH2 1: send:packet of  length 48 (length also 
includes padlen of 18)
*Jul  8 06:20:52.926: SSH2 1: computed MAC for sequence no.#12 type 98
*Jul  8 06:20:52.927: SSH2 1: send:packet of  length 16 (length also 
includes padlen of 6)
*Jul  8 06:20:52.927: SSH2 1: computed MAC for sequence no.#13 type 96
*Jul  8 06:20:52.927: SSH2 1: send:packet of  length 16 (length also 
includes padlen of 6)
*Jul  8 06:20:52.927: SSH2 1: computed MAC for sequence no.#14 type 97
*Jul  8 06:20:52.927: SSH1: Session terminated normally

Using a playbook:


:~/ansible/playbooks$ ansible-playbook tst.yml 




PLAY [testdevices] 

 





TASK [Gathering Facts] 

 


fatal: [host1]: UNREACHABLE! => {"changed": false, "msg": "Failed to 
connect to the host via ssh: Connection closed\r\nConnection to 
192.168.10.200 closed by remote host.\r\n", "unreachable": true} 

to retry, use: --limit @/home/exinadmin/ansible/playbooks/tst.retry 




PLAY RECAP 

 


   : ok=0 changed=0 unreachable=1 failed=0 

Any help will be greatly appreciated !

Phil.









-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/a9342ded-8f5f-4ac9-b972-6978a4bc436e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.