I just noticed that if I only bring the file server VM up and run the ansible setup command, I get an SSH error saying, “data could not be sent to the remote host”. But if I bring the database VM up, the command against the file server runs but the ansible_hostname is “db00”, not “fs00” as I would expect. Is this ansible_hostname fact what Ansible looks at when it tries to identify what server to run the playbook against? That’s what it seems like. I think this may be related to the fact that I created the Vagrant VMs in one directory (playbooks/vagrant) while my actual Ansible playbooks reside in another (playbooks/example). I did this because I initially wrote my playbooks to run against real Debian servers. They run just fine against those servers. I’m only having problems running them against my Vagrant VMs which I built later.
One thing I’m confused about is ansible_hostname versus inventory_hostname. When should each of them be used?
By the way, I’m just using example.com as an example. It’s not my real domain name.
The problem was that I needed to use the inventory file that Vagrant creates in .vagrant/provisioners/ansible/inventory/vagrant_ansible_inventory instead of the inventory/vagrant file I had created. I contains the necessary Ansible directives.