Thank you sir. I was messing around with a very basic setup. Here is a snippet of what i was trying to do:
```
Vagrant.configure("2") do |config|
#config.vm.synced_folder "../data", "/vagrant_data"
(1..NODE_COUNT).each do |i|
config.vm.define "proxy0#{i}" do |subconfig|
subconfig.ssh.private_key_path = ["/Users/jason/.ssh/vagrant", "~/.vagrant.d/insecure_private_key"]
subconfig.vm.provision "file", source: "/Users/jason/.ssh/vagrant.pub", destination: "~/.ssh/authorized_keys"
subconfig.ssh.insert_key = false
subconfig.vm.provider "virtualbox" do |vb|
vb.name = "proxy0#{i}"
vb.memory = 1024
vb.cpus = 1
end
subconfig.vm.box = PLUS_IMAGE
subconfig.vm.hostname = "node0#{i}"
subconfig.vm.network :private_network, ip: "172.16.10.#{i + 20}"
subconfig.vm.network "forwarded_port", guest: 80, host: "#{HA_PORT_START + i}"
subconfig.vm.network "forwarded_port", guest: 8080, host: "#{DASHBOARD + i}"
subconfig.vm.provision "os-setup", :type => "shell", :path => "provisioners/scripts/os-setup.sh"
subconfig.vm.provision "setup-hosts", :type => "shell", :path => "provisioners/scripts/setup-hosts.sh" do |s|
s.args = ["enp0s8"]
end
subconfig.vm.provision "ansible" do |ansible|
ansible.limit = "all"
ansible.playbook = "./provisioners/ansible/mainplus.yml"
ansible.inventory_path = "./provisioners/ansible/inventory"
end
end
end
```
Now, the trouble I am running into is that when ansible goes to run the playbook, it cant connect to the vagrant box (I am assuming, because that host is not in ~/.ssh/config file. I may be wrong though).
I am lining up the name of the hosts in my vagrantfile with that in the inventory file.
That seems to be my road block.
If I remove the ansible section, it works fine. I then do a vagrant ssh-config >> ~/.ssh/config, do a vagrant destroy -f, do a fresh 'vagrant up' and then it works
Hopefully that makes sense.
But that is where I a stuck.
I can run ansible manually, which is fine, but would like to be able to get this to work 'integrated' with the vagrantfile.
Much obliged
Jason