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 On Wednesday, August 12, 2020 at 7:50:48 AM UTC-7 dnmo...@gmail.com wrote: > This is what a very basic Vagrantfile might look like > > # vi: set ft=ruby : > num_machines = 1 > itr = [ > # "bento/centos-6.7", > # "bento/centos-7.2", > # "bento/debian-8.6", > # "bento/fedora-29", > # "bento/ubuntu-16.10", > "bento/ubuntu-18.04", > # "bento/debian-9" > ] > > Vagrant.configure(2) do |config| > > itr.each_with_index do |os, index| > > config.vm.provision "file", source: "package.json", destination: > "package.json" > > puts 'xxxxxxxxxxxxxxxxxxxxxxxxx', os > > # config.ssh.forward_agent = true > > config.vm.define "plu#{index+1}" do |plu| > plu.vm.box = os > plu.vm.box_check_update = true > plu.vm.hostname = "plu#{index+1}" > plu.vm.network "private_network", ip: "192.168.1.9#{index+1}" > > plu.vm.provider "virtualbox" do |v| > v.name = "plu#{index+1}" > v.memory = "512" > end > > > > if index == (itr.length-1) then > config.vm.provision "ansible" do |ansible| > ansible.limit = "plu1" > ansible.playbook = "./playbook.yml" > ansible.inventory_path = "inventory" > # ansible.ask_become_pass = true > ansible.raw_arguments = ["--flush-cache"] > ansible.verbose = "-vvvv" > end > end > > > end > > end > end > > > -- This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list. GitHub Issues: https://github.com/hashicorp/vagrant/issues Discuss: https://discuss.hashicorp.com/c/vagrant/24 --- You received this message because you are subscribed to the Google Groups "Vagrant" group. To unsubscribe from this group and stop receiving emails from it, send an email to vagrant-up+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/vagrant-up/9baf9b52-1165-4a84-9fa6-4ac679f3f217n%40googlegroups.com.