Got it. Yea, I am still learning Ruby and programming for the most part (lots of shell scripts, javascript, yaml files) but its fun and I enjoy it.
I am a bit baffled because I keep testing and changing things, but it does not seem to be executing my ansible.provision block. Here is my full Vagrantfile in case i missed something (going to change the uppercase letters when I gett his figured out) ``` Vagrant.configure("2") do |config| #config.vm.synced_folder "../data", "/vagrant_data" (1..NODE_COUNT).each do |index| config.vm.define "proxy0#{index}" 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.ssh.username = "vagrant" #subconfig.ssh.password = "vagrant" #subconfig.ssh.insert_key = false subconfig.vm.provider "virtualbox" do |vb| vb.name = "proxy0#{index}" vb.memory = 1024 vb.cpus = 1 end subconfig.vm.box = PLUS_IMAGE subconfig.vm.hostname = "proxy0#{index}" subconfig.vm.network :private_network, ip: "172.16.10.#{index + 20}" subconfig.vm.network "forwarded_port", guest: 80, host: "#{HA_PORT_START + index}" subconfig.vm.network "forwarded_port", guest: 8080, host: "#{DASHBOARD + index}" 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"] if config == NODE_COUNT then config.vm.provision "ansible" do |ansible| ansible.limit = "all" ansible.playbook = "./provisioners/ansible/mainplus.yml" ansible.inventory_path = "./provisioners/ansible/inventory" end end end end end (1..NODE_COUNT).each do |i| config.vm.define "web0#{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.ssh.username = "vagrant" #subconfig.ssh.password = "vagrant" #subconfig.ssh.insert_key = false subconfig.vm.provider "virtualbox" do |vb| vb.name = "web0#{i}" vb.memory = 1024 vb.cpus = 1 end subconfig.vm.box = PLUS_IMAGE subconfig.vm.hostname = "web0#{i}" subconfig.vm.network :private_network, ip: "192.168.10.#{i + 10}" subconfig.vm.network "forwarded_port", guest: 80, host: "#{HOST_PORT_START + 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"] if config == NODE_COUNT then config.vm.provision "ansible" do |ansible| ansible.limit = "all" ansible.playbook = "./provisioners/ansible/mainfoss.yml" ansible.inventory_path = "./provisioners/ansible/inventory" end end end end end end ``` Is there a way to 'walkthrough' a Vagrantfile, watch/read the execute parts of the file. Thanks On Wednesday, August 12, 2020 at 1:53:34 PM UTC-7 dnmo...@gmail.com wrote: > if index == NODE_COUNT then > > config.vm.provision "ansible" do |ansible| > #ansible.limit = "all" > ansible.playbook = "./provisioners/ansible/mainplus.yml" > ansible.inventory_path = "./provisioners/ansible/inventory" > end > > end > > You're probably looking for above. > > Incidentally, the language you're writing this in is Ruby. if you want to > see output of any kind you can use > > puts 'some message = ', index, NODE_COUNT > > which would output something like: > > some message = 0, 0 > > This will help in your debugging. > > Lastly, as a FYI, in programming, variable names with ALL_CAPS are > typically reserved for constants (variables that are immutable i.e. don't > change) or used for Environment variables (e.g. $HOME). While what you > wrote works, it might be confusing to someone to see some index count in > ALL CAPS changing on every iteration. > > > > On Wednesday, August 12, 2020 at 9:34:34 AM UTC-4, jason.wi...@gmail.com > wrote: > >> Hey folks. >> Looking for some help on how to get my setup working correctly. >> I can use ansible AFTER vagrant up is working, by running: >> >> vagrant ssh-config >> ~/.ssh/config >> Now can read the file and SSH into the host and run the playbooks. >> >> How does that work when i am running ansilbe within vagrant up? Do you >> need to add the hosts into ~/.ssh/config ahead of time? >> Just looking for help on how to get this working properly >> >> Thanks >> > -- 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/cbc252f6-ef85-4ec0-bb5e-5d8a3531e96an%40googlegroups.com.