ansible ssh prompt known_hosts issue

前端 未结 7 1264
甜味超标
甜味超标 2020-12-23 16:25

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          


        
7条回答
  •  长情又很酷
    2020-12-23 17:00

    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.

提交回复
热议问题