Ansible provisioning ERROR! Using a SSH password instead of a key is not possible

后端 未结 5 1417
深忆病人
深忆病人 2021-02-04 01:31

I would like to provision with my three nodes from the last one by using Ansible.

My host machine is Windows 10.

My Vagrantfile looks like:



        
5条回答
  •  野的像风
    2021-02-04 01:53

    I had a similar challenge when working with Ansible 2.9.6 on Ubuntu 20.04.

    When I run the command:

    ansible all -m ping -i inventory.txt
    

    I get the error:

    target | FAILED! => { "msg": "Using a SSH password instead of a key is not possible because Host Key checking is enabled and sshpass does not support this. Please add this host's fingerprint to your known_hosts file to manage this host." }

    Here's how I fixed it:

    When you install ansible, it creates a file called ansible.cfg, this can be found in the /etc/ansible directory. Simply open the file:

    sudo nano /etc/ansible/ansible.cfg
    

    Uncomment this line to disable SSH key host checking

    host_key_checking = False
    

    Now save the file and you should be fine now.

    Note: You could also try to add the host's fingerprint to your known_hosts file by SSHing into the server from your machine, this prompts you to save the host's fingerprint to your known_hosts file:

    promisepreston@ubuntu:~$ ssh myusername@192.168.43.240
    
    The authenticity of host '192.168.43.240 (192.168.43.240)' can't be established.
    ECDSA key fingerprint is SHA256:9Zib8lwSOHjA9khFkeEPk9MjOE67YN7qPC4mm/nuZNU.
    Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
    Warning: Permanently added '192.168.43.240' (ECDSA) to the list of known hosts.
    
    myusername@192.168.43.240's password: 
    Welcome to Ubuntu 20.04.1 LTS (GNU/Linux 5.4.0-53-generic x86_64)
    

    That's all.

    I hope this helps

提交回复
热议问题