Error when trying to ping nodes through Ansible

111 views
Skip to first unread message

Jørgen Høyer

unread,
Jul 13, 2016, 4:52:36 AM7/13/16
to Ansible Project
My project is to set up a sensor network of several nodes. I want to use Ansible to configure all nodes through ssh, so I downloaded ansible with pip and generated a ssh keypair. I then copied the key from the master to the node I am testing on. I also edited the host file with:

[node]

pi@###.###.###.###

I know I can access the node through ssh, because I did a ssh pi@###.###.###.### and got connection. I also tried to ping the ip and it worked like it should. Now, when I try to ping with ansible (ansible all -m ping) it won't work. I get the id_rsa password prompt, but after that I get this error message:

pi@###.###.###.### | UNREACHABLE! => {
    "changed": false,
    "msg": "SSH Error: data could not be sent to the remote host. Make sure this host can be reached over ssh",
    "unreachable": true
}

Since I know the host can be reached over ssh I really don't know how to get around this hurdle. Does anyone know what's wrong?

All help would be much appriciated!
 
Message has been deleted

Jørgen Høyer

unread,
Jul 13, 2016, 4:59:48 AM7/13/16
to Ansible Project
One last thing:) if i run ansible -vvvv i get at the end of the output:

ERROR! Missing target hosts


Kai Stian Olstad

unread,
Jul 13, 2016, 5:11:21 AM7/13/16
to ansible...@googlegroups.com
On 13.07.2016 10:52, Jørgen Høyer wrote:
> My project is to set up a sensor network of several nodes. I want to
> use
> Ansible to configure all nodes through ssh, so I downloaded ansible
> with
> pip and generated a ssh keypair. I then copied the key from the master
> to
> the node I am testing on. I also edited the host file with:
>
> [node]
>
> pi@###.###.###.###
>

Your inventory file(that you call host file) is wrong.
I suggest you read this
https://docs.ansible.com/ansible/intro_inventory.html

--
Kai Stian Olstad
Message has been deleted

Werner Flamme

unread,
Jul 13, 2016, 5:35:06 AM7/13/16
to ansible...@googlegroups.com
Did you even look at the page Kai sent the link to?

You can write something like

[nodes]
192.168.137.146 ansible_user=pi

but "p...@192.168.137.146" is senseless.

HTH,
Werner


Jørgen Høyer [13.07.2016 11:29]:
> My file looks like this:
>
> [nodes]
> p...@192.168.137.146
>
> Only two lines. It's called hosts.
> Is that not the right way to create an inventory?
--


Jørgen Høyer

unread,
Jul 13, 2016, 5:38:50 AM7/13/16
to Ansible Project
Sorry, I took a look at it. Just didn't get it, i'm very new to this..Thank you for responding^^

Jørgen Høyer

unread,
Jul 13, 2016, 5:44:28 AM7/13/16
to Ansible Project
Thank you so much, that worked! What's that atachment?

onsdag 13. juli 2016 11.35.06 UTC+2 skrev Werner Flamme følgende:

Jørgen Høyer

unread,
Jul 13, 2016, 5:46:39 AM7/13/16
to Ansible Project
Ah, just an secure e-mail. Ok.


onsdag 13. juli 2016 11.35.06 UTC+2 skrev Werner Flamme følgende:
Reply all
Reply to author
Forward
0 new messages