Hey,
I am probably missing something very obvious, but here is my situation
I use Vagrant to spin up some VMs, to make it easy, it is like this:
ansible VM
host1 VM
host2 VM
hostN VM
My goal is that I want ansible installed on the ansible VM within Vagrant (virtualbox), and I want to kick off my playbook and have ansible install all the goodies on host1-n.
So, what works, is that ansible gets installed and runs, very simple to do there, what doesn’t work is connecting to any of the other Vagrant VMs with
fatal: [192.168.50.101]: UNREACHABLE! => {“changed”: false, “msg”: “Failed to connect to the host via ssh.”, “unreachable”: true}
I have exactly no idea what I am doing wrong here, but obviously it is something with ssh I have tried using the private_key from the virtualmachine in a place where ansible can see it, and creating a host_vars directory with files like
filename: 192.168.50.20
content: ansible_ssh_private_key_file: /home/vargrant/sync/.vagrant/machines/host1/virtualbox/private_key
but alas, that doesn’t work either. Any help would be greatly appreciated as I have hit a brick wall.
To note, my ansible playbook works fine on the vm it is running on, named “ansible”, just can’t connect to the other vms, even though I can ping them and ssh to them manually using the standard vagrant username/pass from within the ansible machine