ansible-for-devops
ansible-for-devops copied to clipboard
VagrantBox Mac OS Ventura Host Only bug
There is a current Vagrant issue plaguing the Mac community on the new Ventura OS.
The fix involves adding the following to your Vagrantfile for each server: For example, I'm referencing Chapter 3's Vagrantfile definition of Application server 1:
config.vm.define "app1" do |app|
db.vm.hostname = "orc-app1.test"
db.vm.network :private_network, ip: "192.168.60.4"
end
A resulting vagrant up
command will properly provision the box to a point... only to error on something like:
... If you're running on MacOS Ventura, you have to add the virtualbox__intnet: true
flag on each "app".vm.network
. So the above becomes:
config.vm.define "app1" do |app|
db.vm.hostname = "orc-app1.test"
db.vm.network :private_network, ip: "192.168.60.4", virtualbox__intnet: true
end
Now, that all said, I'm reading this book to learn ansible as well as vagrant... so I am in no position to propose a solution for ALL or even a subset of OSes that can be used to run vagrant... What I am proposing is a disclaimer that users of MacOS Ventura note this subtle but potentially breaking changes that were introduced via Ventura.
Cheers, loving the book so far and the videos!
Honestly I'm considering moving to a new model instead of Vagrant (or at least Vagrant + VirtualBox) for the book examples... we'll see.
Thanks for posting the solution @KPomorski. You might want to update your code example to be
config.vm.define "app1" do |db|
db.vm.hostname = "orc-app1.test"
db.vm.network :private_network, ip: "192.168.60.4", virtualbox__intnet: true
end
Just so that if someone wants to copy paste, they won't run into another issue with the conflict of app
and db
.
This is happening to me as well on Catalina 10.15.7, adding virtualbox__intnet: true did make the error disappear. VBox 7.02
I'm still on Montery and am having this problem. I confirm that adding virtualbox__intnet: true
works for me too.
using vagrant and virtualbox was clever, but I wonder if it's time to test out vagrant and docker? https://developer.hashicorp.com/vagrant/docs/providers/docker
Edit: oh, it seems like you're already tinkering with that direction: https://hub.docker.com/r/geerlingguy/docker-rockylinux9-ansible
I'm going to start using those containers instead of Virtualbox VMs and see how it goes.
Moar edits!:
- okay, so your docker images weren't what I had assumed. You're using them in your CI pipelines and they have ansible installed in them.
- I assumed the docker image I linked would be a basic rocky linux base that has SSH installed into it so vagrant can get access to it via SSH
Perhaps referencing an inventory of containers orchestrated by docker-compose is The Way: https://techq.medium.com/how-to-setup-ansible-dynamic-inventory-for-docker-using-ansible-plugin-ec308e677cd6
@ajisrael @KPomorski Could you please post your fully working Vagrant file from chapter 3? I've tried to manually edit, but something is still tripping me up. Thanks!