Cant SSH / PING to Network Devices

62 views
Skip to first unread message

Nirmal Gauda

unread,
Dec 21, 2019, 9:57:59 AM12/21/19
to Ansible Project
I am a Newbie to Ansible , writing my first playbook.

I can not SSH / PING to network Devices.

leaf-1 | UNREACHABLE! => {
   
"changed": false,
   
"msg": "Authentication failure.",
   
"unreachable": true
}
leaf
-2 | UNREACHABLE! => {
   
"changed": false,
   
"msg": "Authentication failure.",
   
"unreachable": true
}

i can PING / SSH to network devices from Ansible server but when i run the playbook , it fails.

No idea if i have to add something in playbook or ansible.cfg . Any Suggestion please ?


Jonathan Lozada De La Matta

unread,
Dec 21, 2019, 10:03:11 AM12/21/19
to ansible...@googlegroups.com
can you ssh without ansible into those hosts?

--
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-proje...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/92ff7b85-295a-4910-9b00-4a3b50b6cbb4%40googlegroups.com.
--

Jonathan Cha'gara Lozada De La Matta

He / Him / His

Red Hat

Senior Automation Practice Consultant & Automation CoP Manager

Join the Automation CoP! https://red.ht/autocop

 

Nirmal Gauda

unread,
Dec 21, 2019, 10:08:19 AM12/21/19
to ansible...@googlegroups.com
yes i can SSH from Ansible Server , via putty as well

Jonathan Lozada De La Matta

unread,
Dec 21, 2019, 10:15:14 AM12/21/19
to ansible...@googlegroups.com
show how you you ssh in with ansible and without ansible. Your plsybook and cfg file.

Nirmal Gauda

unread,
Dec 21, 2019, 10:29:01 AM12/21/19
to Ansible Project
ansible.cfg :


[defaults]
inventory
= ./inventories/
Inventories :


[leaf]


leaf
-1
leaf
-2


playbook :

- hosts: all
  remote_user: admin
  vars:
    authorized_key_list:
      - name: admin
        authorized_keys:
         - key: "{{ lookup('file', '~/.ssh/id_rsa.pub') }}"
           state: present
  roles:
    - { role: GROG.authorized-key }

Dick Visser

unread,
Dec 21, 2019, 11:18:15 AM12/21/19
to ansible...@googlegroups.com
First make sure ansible can actually sign in to the target hosts before trying to use roles. I’m guessing here but that role name indicates something related which might impact the connection. 

So best to start here: 
And then try something simple such as the a file or copy task. 
Once that works move on to more complicated things like roles. 

Dick 


--
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-proje...@googlegroups.com.
--
Sent from a mobile device - please excuse the brevity, spelling and punctuation.

Nirmal Gauda

unread,
Dec 21, 2019, 11:40:25 AM12/21/19
to Ansible Project
[root@ansible01 test]# ping leaf-1
PING leaf
-1.lab.com (192.168.7.1) 56(84) bytes of data.
64 bytes from testing_1F.lab.com (192.168.7.1): icmp_seq=1 ttl=253 time=0.701 ms
64 bytes from testing_1F.lab.com (192.168.7.1): icmp_seq=2 ttl=253 time=0.623 ms
64 bytes from testing_1F.lab.com (192.168.7.1): icmp_seq=3 ttl=253 time=0.736 ms

[root@ansible01 test]# ansible leaf-1  -m ping
/usr/lib/python2.7/site-packages/requests/__init__.py:80: RequestsDependencyWarning: urllib3 (1.22) or chardet (2.2.1) doesn't match a supported version!
  RequestsDependencyWarning)

leaf-1 | UNREACHABLE! => {
    "changed": false,
    "msg": "Failed to connect to the host via ssh:

On Saturday, 21 December 2019 20:27:59 UTC+5:30, Nirmal Gauda wrote:

Nirmal Gauda

unread,
Dec 21, 2019, 11:51:19 PM12/21/19
to Ansible Project
on more thing : i have logged in to ansible server as "root" but my username to log in to network device is "admin" ... do i have to define that somewhere ?

Stefan Hornburg (Racke)

unread,
Dec 22, 2019, 2:35:53 AM12/22/19
to ansible...@googlegroups.com
On 12/22/19 5:51 AM, Nirmal Gauda wrote:
> on more thing : i have logged in to ansible server as "root" but my username to log in to network device is "admin" ...
> do i have to define that somewhere ?
>

Use the ansible_user variable.

Further information:
https://docs.ansible.com/ansible/latest/user_guide/intro_inventory.html#connecting-to-hosts-behavioral-inventory-parameters

Regards
Racke

> On Saturday, 21 December 2019 22:10:25 UTC+5:30, Nirmal Gauda wrote:
>
> |
> [root@ansible01 test]# ping leaf-1
> PING leaf-1.lab.com (192.168.7.1)56(84)bytes of data.
> 64bytes fromtesting_1F.lab.com (192.168.7.1):icmp_seq=1ttl=253time=0.701ms
> 64bytes fromtesting_1F.lab.com (192.168.7.1):icmp_seq=2ttl=253time=0.623ms
> 64bytes fromtesting_1F.lab.com (192.168.7.1):icmp_seq=3ttl=253time=0.736ms
> |
>
> |
> [root@ansible01 test]# ansible leaf-1  -m ping
> /usr/lib/python2.7/site-packages/requests/__init__.py:80:RequestsDependencyWarning:urllib3 (1.22)orchardet
> (2.2.1)doesn't match a supported version!
>   RequestsDependencyWarning)
> leaf-1 | UNREACHABLE! => {
>     "changed": false,
>     "msg": "Failed to connect to the host via ssh:
> |
>
> On Saturday, 21 December 2019 20:27:59 UTC+5:30, Nirmal Gauda wrote:
>
> I am a Newbie to Ansible , writing my first playbook.
>
> I can not SSH / PING to network Devices.
>
> |
> leaf-1|UNREACHABLE!=>{
>     "changed":false,
>     "msg":"Authentication failure.",
>     "unreachable":true
> }
> leaf-2|UNREACHABLE!=>{
>     "changed":false,
>     "msg":"Authentication failure.",
>     "unreachable":true
> }
>
> i can PING / SSH to network devices from Ansible server but when i run the playbook , it fails.
>
> No idea if i have to add something in playbook or ansible.cfg . Any Suggestion please ?
>
> |
>
> --
> 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-proje...@googlegroups.com <mailto:ansible-proje...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/ec803d2b-08a7-4f55-b212-a98ca902ad28%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/ec803d2b-08a7-4f55-b212-a98ca902ad28%40googlegroups.com?utm_medium=email&utm_source=footer>.


--
Ecommerce and Linux consulting + Perl and web application programming.
Debian and Sympa administration. Provisioning with Ansible.

signature.asc

Nirmal Gauda

unread,
Dec 30, 2019, 6:00:33 AM12/30/19
to Ansible Project
i added below in INVENTORY file ... no luck ..

leaf-1 ansible_ssh_pass=XXXXX ansible_ssh_user=XXXX

Thanks
NIrmal
Reply all
Reply to author
Forward
0 new messages