My /etc/hosts
file looks like this:
# Your system has configured 'manage_etc_hosts' as True.
# As a result, if you wish for changes to this file to persist
# then you will need to either
# a.) make changes to the master file in /etc/cloud/templates/hosts.tmpl
# b.) change or remove the value of 'manage_etc_hosts' in
# /etc/cloud/cloud.cfg or cloud-config from user-data
127.0.1.1 ansible-server ansible-server
127.0.0.1 localhost
# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts
node1 0.0.0.0
node2 0.0.0.0
I have added the node1
and node2
and naturally the IP 0.0.0.0
is replaced by the IP of the node.
I would assume this works perfectly fine, however it doesn't. I thought SSH simply ignores the hosts
file:
root@ansible-server:~# ssh root@node1
ssh: Could not resolve hostname node1: Name or service not known
root@ansible-server:~# ssh root@node2
ssh: Could not resolve hostname node2: Name or service not known
However, I can't ping these servers by their name either:
root@ansible-server:~# ping node1
ping: unknown host node1
root@ansible-server:~# ping node2
ping: unknown host node2
It is pretty clear I'm doing something really stupid here... but what?
Additional information: this server runs Ubuntu 14.04.2 LTS and is hosted on DigitalOcean. The server this is occurring on an Ansible server.