I'm using vagrant with ansible.
I have 2 VM mgmt and web1 with debian in both, where mgmt try to Ansible ping command to web1. I try a lot of solutions but doesn't works, just can't find what is going wrong. The command "ansible -i hosts web1 -m ping -vvv", where i config web1 with the ping of vm.
ansible 2.8.5
config file = /etc/ansible/ansible.cfg
configured module search path = [u'/usr/share/my_modules']
ansible python module location = /usr/local/lib/python2.7/dist-packages/ansible
executable location = /usr/local/bin/ansible
python version = 2.7.13 (default, Sep 26 2018, 18:42:22) [GCC 6.3.0 20170516]
Using /etc/ansible/ansible.cfg as config file
host_list declined parsing /home/vagrant/ansible/hosts as it did not pass it's verify_file() method
script declined parsing /home/vagrant/ansible/hosts as it did not pass it's verify_file() method
auto declined parsing /home/vagrant/ansible/hosts as it did not pass it's verify_file() method
Parsed /home/vagrant/ansible/hosts inventory source with ini plugin
META: ran handlers
<10.0.15.21> ESTABLISH SSH CONNECTION FOR USER: root
<10.0.15.21> SSH: EXEC sshpass -d11 ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o Port=22 -o 'IdentityFile="/home/vagrant/.ssh/id_rsa.pub"' -o 'User="root"' -o ConnectTimeout=10 -o ControlPath=/root/.ansible/cp/0b0f61e888 10.0.15.21 '/bin/bash -c '"'"'echo ~root && sleep 0'"'"''
<10.0.15.21> (255, '', 'Permission denied (publickey).\r\n')
<10.0.15.21> ssh_retry: attempt: 1, ssh return code is 255. cmd (['sshpass', '-d11', 'ssh', '-C', '-o', 'ControlMaster=auto', '-o', 'ControlPersist=60s', '-o', 'StrictHostKeyChecking=no', '-o', 'Port=22', '-o', 'IdentityFile="/home/vagrant/.ssh/id_rsa.pub"', '-o', 'User="root"', '-o', 'ConnectTimeout=10', '-o', 'ControlPath=/root/.ansible/cp/0b0f61e888', '10.0.15.21', "/bin/bash -c 'echo ~root && sleep 0'"]...), pausing for 0 seconds
<10.0.15.21> SSH: EXEC sshpass -d11 ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o Port=22 -o 'IdentityFile="/home/vagrant/.ssh/id_rsa.pub"' -o 'User="root"' -o ConnectTimeout=10 -o ControlPath=/root/.ansible/cp/0b0f61e888 10.0.15.21 '/bin/bash -c '"'"'echo ~root && sleep 0'"'"''
<10.0.15.21> (255, '', 'Permission denied (publickey).\r\n')
<10.0.15.21> ssh_retry: attempt: 2, ssh return code is 255. cmd (['sshpass', '-d11', 'ssh', '-C', '-o', 'ControlMaster=auto', '-o', 'ControlPersist=60s', '-o', 'StrictHostKeyChecking=no', '-o', 'Port=22', '-o', 'IdentityFile="/home/vagrant/.ssh/id_rsa.pub"', '-o', 'User="root"', '-o', 'ConnectTimeout=10', '-o', 'ControlPath=/root/.ansible/cp/0b0f61e888', '10.0.15.21', "/bin/bash -c 'echo ~root && sleep 0'"]...), pausing for 1 seconds
<10.0.15.21> SSH: EXEC sshpass -d11 ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o Port=22 -o 'IdentityFile="/home/vagrant/.ssh/id_rsa.pub"' -o 'User="root"' -o ConnectTimeout=10 -o ControlPath=/root/.ansible/cp/0b0f61e888 10.0.15.21 '/bin/bash -c '"'"'echo ~root && sleep 0'"'"''
<10.0.15.21> (255, '', 'Permission denied (publickey).\r\n')
<10.0.15.21> ssh_retry: attempt: 3, ssh return code is 255. cmd (['sshpass', '-d11', 'ssh', '-C', '-o', 'ControlMaster=auto', '-o', 'ControlPersist=60s', '-o', 'StrictHostKeyChecking=no', '-o', 'Port=22', '-o', 'IdentityFile="/home/vagrant/.ssh/id_rsa.pub"', '-o', 'User="root"', '-o', 'ConnectTimeout=10', '-o', 'ControlPath=/root/.ansible/cp/0b0f61e888', '10.0.15.21', "/bin/bash -c 'echo ~root && sleep 0'"]...), pausing for 3 seconds
<10.0.15.21> SSH: EXEC sshpass -d11 ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o Port=22 -o 'IdentityFile="/home/vagrant/.ssh/id_rsa.pub"' -o 'User="root"' -o ConnectTimeout=10 -o ControlPath=/root/.ansible/cp/0b0f61e888 10.0.15.21 '/bin/bash -c '"'"'echo ~root && sleep 0'"'"''
<10.0.15.21> (255, '', 'Permission denied (publickey).\r\n')
10.0.15.21 | UNREACHABLE! => {
"changed": false,
"msg": "Failed to connect to the host via ssh: Permission denied (publickey).",
"unreachable": true