Hi
I'm trying to set up a quick test host and have added this entry in my
~/.ssh/config:
# Test host
Host imapsync
Hostname 2001:610:148:f00d:20c:29ff:fe14:ccfe
Just issuing "ssh imapsync" works fine.
I have this corresponding in my ansible inventory:
# test host
imapsync
But when I try to run "ansible imapsync -m setup", I get:
"SSH Error: data could not be sent to the remote host. Make sure this
host can be reached over ssh".
It turns out that the literal IPv6 address is the culprit.
If I enable IPv4 on the host and change the ssh config to:
# Test host
Host imapsync
Hostname 192.87.38.66
Then things work.
Is there another way of specifying a literal IPv6 address.
PS I also tested using DNS by adding the name to /etc/hosts, and that
seems to work as well.
But the whole point of having ssh config's "Hostname" and ansible's
inventory is to no use DNS.
Thanks!
I thought ssh needed IPv6 addresses in square brackets (to avoid
confusion with ports added as suffix)?
Host imapsync
Hostname [2001:610:148:f00d:20c:29ff:fe14:ccfe]
Johannes
Nope that doesn't work, neither in .ss/config nor on the command line.
You need the Port option, or -p on the command line.
The bracket notation isn't used by OpenSSH.
I know that for web browsers the brackets are mandatory when using
IPv6 literals.
As a workaround, what happens if you append the port?
Host imapsync
Hostname [2001:610:148:f00d:20c:29ff:fe14:ccfe]:22
This should be valid ssh syntax, at least I have some of those in my
config or known_hosts.
Johannes
It doesn't work here:
~$ ssh imapsync
ssh: Could not resolve hostname
[2001:610:148:f00d:20c:29ff:fe14:ccfe]:22: nodename nor servname
provided, or not known
This is on MacOS using OpenSSH_7.3p1, LibreSSL 2.4.1.
But I just tried on an Ubuntu box (OpenSSH_7.2p2 Ubuntu-4ubuntu2.1,
OpenSSL 1.0.2g 1 Mar 2016) and the same result there.
Not a show stopper but I'd like to avoid using scarce IPv4 addresses.
Dick
Sorry, my mistake, those were not in Hostname declarations.
I do not have a ipv6 host handy, so I can't test...
Johannes
Just for fun I tested this, it work for me.
I'm running Ansible 2.1.2 at the moment.
Just check the output of -vvvvv and ran the same command in a shell:
dick.visser@MacBookAir-DIck:~$ ssh -C -o ControlMaster=auto -o
ControlPersist=60s -o KbdInteractiveAuthentication=no -o
PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey
-o PasswordAuthentication=no -o ConnectTimeout=20 -o
ControlPath=/Users/dick.visser/.ansible/cp/ansible-ssh-%h-%p-%r
imapsync
unix_listener: "/Users/dick.visser/.ansible/cp/ansible-ssh-2001:610:148:f00d:20c:29ff:fe14:ccfe-22-visser.yQ7UwntkXwvGTUmk"
too long for Unix domain socket
After using the hint from
http://docs.ansible.com/ansible/intro_configuration.html#control-path
things started working.
Dick