How do I configure SSH keys in a Vagrant multi-machine setup?

HOW TO -️ October 18, 2021

I have 4 VMs in my Vagrantfile - 3 application servers and an Ansible control host.

I only use Vagrant to create the VMs as I provision them manually from the ansible control host because I am still creating/editing the ansible scripts.

I can do vagrant ssh ansible and vagrant ssh app1/2/3 etc. but when I try to do ansible-playbook oracle.yml from the Ansible control host, SSH fails with

ERROR Rendering Code Block

I can successfully ssh from the Ansible VM to the Oracle VM using user vagrant and password vagrant.

The key parts of my Vagrantfile are:

ERROR Rendering Code Block

What do I need to put in the Vagrantfile to allow the Ansible VM to connect to the other VMs without requiring a password or extra manual steps after vagrant up?

This is just for development testing on a private network on developers PCs so security is not really an issue and comes second to ease of implementation and smooth user experience.

Answer

Duplicate of https://devops.stackexchange.com/questions/1017/unable-to-ssh-in-a-mutli-machine-vagrant-environment I stated quite clearly that I can ssh between VMs it is just that ansible cannot because it requires keys set up. He cannot ssh. The questions are clearly different. @JamesShewey: I don't think that any answer for that question is relevant to that. The answer given refers to communications from the host to the guests; the needed answer needs to apply between guests.

Initializing...