Hmm, that would make sense. Let me modify the vagrantfile and a little and respond with my latest results THanks for all the help!
On Wednesday, August 12, 2020 at 8:31:22 AM UTC-7 [email protected] wrote: > I think the issue you are running into is that it's running the playbook > before the VM has actually finished spinning up. If you look at my > Vagrantfile, I actually wait to start running the playbooks after the last > VM is created. > > if index == (itr.length-1) then > config.vm.provision "ansible" do |ansible| > ansible.limit = "plu1" > ansible.playbook = "./playbook.yml" > ansible.inventory_path = "inventory" > ansible.raw_arguments = ["--flush-cache"] > ansible.verbose = "-vvvv" > end > end > > On Wednesday, August 12, 2020 at 11:13:30 AM UTC-4, Jason Williams wrote: > >> Yea, the box comes up fine and the private key works, as it should, but >> ansible fails when executing the playbook: >> Here is the error output: >> >> ==> proxy01: Running provisioner: ansible... >> proxy01: Running ansible-playbook... >> >> PLAY [all] >> ********************************************************************* >> >> TASK [Gathering Facts] >> ********************************************************* >> fatal: [web02]: UNREACHABLE! => {"changed": false, "msg": "Failed to >> connect to the host via ssh: ", "unreachable": true} >> fatal: [proxy01]: UNREACHABLE! => {"changed": false, "msg": "Failed to >> connect to the host via ssh: ssh: Could not resolve hostname proxy01: >> nodename nor servname provided, or not known", "unreachable": true} >> fatal: [proxy02]: UNREACHABLE! => {"changed": false, "msg": "Failed to >> connect to the host via ssh: ssh: Could not resolve hostname proxy02: >> nodename nor servname provided, or not known", "unreachable": true} >> >> Am I correct in assuming ansible reads ~/.ssh/config to SSH into the >> vagrant box? >> >> Much obliged! >> >> >> >> >> On Wed, Aug 12, 2020 at 8:09 AM D Morgan <[email protected]> wrote: >> > If you comment out these three lines does it work as expected? >>> >>> 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 >>> >>> >>> >>> On Wednesday, August 12, 2020 at 9:34:34 AM UTC-4, [email protected] >>> 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 a topic in the >>> Google Groups "Vagrant" group. >>> To unsubscribe from this topic, visit >>> https://groups.google.com/d/topic/vagrant-up/LWuwDW97f04/unsubscribe. >>> >> To unsubscribe from this group and all its topics, send an email to >>> [email protected]. >> >> >>> To view this discussion on the web visit >>> https://groups.google.com/d/msgid/vagrant-up/a09130c8-e73b-4f07-b945-3a7057269402o%40googlegroups.com >>> >>> <https://groups.google.com/d/msgid/vagrant-up/a09130c8-e73b-4f07-b945-3a7057269402o%40googlegroups.com?utm_medium=email&utm_source=footer> >>> . >>> >> -- 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/vagrant-up/8c271b5d-4890-400d-8c95-61b18dad38b3n%40googlegroups.com.
