So I want to reach out to my router. I first try
raub@desktop:~/dev/ansible$ ssh
jan...@uranus.example.com
janitor@uranus.
example.com's password:
which is expected since I have ssh'd into the router quite many times
from this computer. i.e. by now it knows uranus quite well. Just to be
paranoid, let's try port 830 as this is a Juniper router:
raub@desktop:~/dev/ansible$ ssh -p 830
jan...@uranus.mgmt.kushana.com
jan...@uranus.mgmt.kushana.com's password:
So far so good. Then I run a quick ansible test:
raub@desktop:~/dev/ansible$ ansible-playbook -vvv network.yml --limit uranus
[...]
ok: [uranus] => {
"changed": false,
"elapsed": 0,
"invocation": {
"module_args": {
"active_connection_states": [
"ESTABLISHED",
"FIN_WAIT1",
"FIN_WAIT2",
"SYN_RECV",
"SYN_SENT",
"TIME_WAIT"
],
"connect_timeout": 5,
"delay": 0,
"exclude_hosts": null,
"host": "
uranus.example.com",
"msg": null,
"path": null,
"port": 830,
"search_regex": null,
"sleep": 1,
"state": "started",
"timeout": 300
}
},
"match_groupdict": {},
"match_groups": [],
"path": null,
"port": 830,
"search_regex": null,
"state": "started"
}
TASK [network : Get facts about "uranus"]
****************************************
task path: /home/raub/dev/ansible/roles/network/tasks/juniper.yml:9
<uranus> using connection plugin netconf (was local)
<uranus> ESTABLISH NETCONF SSH CONNECTION FOR USER: janitor on PORT
830 TO uranus
The full traceback is:
Traceback (most recent call last):
File "/usr/bin/ansible-connection", line 104, in start
self.connection._connect()
File "/usr/lib/python2.7/dist-packages/ansible/plugins/connection/netconf.py",
line 327, in _connect
raise AnsibleConnectionFailure(to_native(exc))
AnsibleConnectionFailure: Unknown host key
[4e:a5:b7:0f:cf:a7:45:1b:e0:0a:d8:96:63:d9:6c:fc] for [uranus]
fatal: [uranus]: FAILED! => {
"msg": "Unknown host key
[4e:a5:b7:0f:cf:a7:45:1b:e0:0a:d8:96:63:d9:6c:fc] for [uranus]"
}
PLAY RECAP ***********************************************************************
uranus : ok=3 changed=0 unreachable=0
failed=1 skipped=0 rescued=0 ignored=0
I would expect an ""Unknown host key" error to mean it has never
connected to the router. Does that mean it is not using the
~/.ssh/known_hosts file?