I\'m running Ansible playbook and it works fine on one machine.
On a new machine when I try for the first time, I get the following error.
17:04:34
Wouldn't doing something like this work for priming the known_hosts file:
ANSIBLE_HOST_KEY_CHECKING=false ansible all -m ping
This should connect to each hosts in the inventory, updating the known_hosts file for each host without having to enter "yes" for each prompt, then runs the "ping" module on each host?
A quick test (deleting my known_hosts file then running the above, done on an Ubuntu 16.04 instance) seemed to populate the known_hosts file with their current fingerprints.
@Stepan Vavra's solution didn't work for me as I was using aliased hosts (was connecting to internal IPs which didn't have DNS available for them, so I wanted more descriptive names to refer to each hosts in the inventory and having ansible_host variable point to the actual IP for each). Running the above was much simpler and primed my known_hosts file without having to disable host key checking in ansible or ssh.