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

后端 未结 5 1423
深忆病人
深忆病人 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 02:12

    This SO post gave the answer.

    I just extended the known_hosts file on the machine that is responsible for the provisioning like this:

    Snippet from my modified Vagrantfile:

    ...
    if index == 3
        node.vm.provision :pre, type: :shell, path: "install.sh"
    
        node.vm.provision :setup, type: :ansible_local do |ansible|
    ...
    

    My install.sh looks like:

    # add web/database hosts to known_hosts (IP is defined in Vagrantfile)
    ssh-keyscan -H 192.168.10.11 >> /home/vagrant/.ssh/known_hosts
    ssh-keyscan -H 192.168.10.12 >> /home/vagrant/.ssh/known_hosts
    ssh-keyscan -H 192.168.10.13 >> /home/vagrant/.ssh/known_hosts
    chown vagrant:vagrant /home/vagrant/.ssh/known_hosts
    
    # reload ssh in order to load the known hosts
    /etc/init.d/ssh reload
    

提交回复
热议问题