Vagrant Hosts Files Not Bing Updated with IP Address

As of recently, I’ve noticed that the IP Address for my Vagrant Virtual Machines hasn’t been added to my /etc/hosts file on Vagrant up. I’m getting the following error when initially running Vagrant Up:

RUNNING HANDLER [common : reload nginx] ****************************************
System info:
Ansible 2.2.0.0; Vagrant 2.0.2; Darwin
Trellis at “Add ansible_local support for non-Windows”

nginx: [emerg] open()
"/srv/www/example.com/current/web/app/uploads/nginx-
helper/map.conf" failed (2: No such file or directory) in /etc/nginx/sites-
enabled/example.com.conf:8
nginx: configuration file /etc/nginx/nginx.conf test failed
fatal: [default]: FAILED! => {“changed”: true, “cmd”: [“nginx”, “-t”], “delta”: “0:00:00.036584”, “end”: “2018-02-07 03:31:31.078948”, “failed”: true, “rc”: 1, “start”: “2018-02-07 03:31:31.042364”, “stderr”: “nginx: [emerg] open() “/srv/www/example.com/current/web/app/uploads/nginx-helper/map.conf” failed (2: No such file or directory) in /etc/nginx/sites-enabled/example.com.conf:8\nnginx: configuration file /etc/nginx/nginx.conf test failed”, “stdout”: “”, “stdout_lines”: [], “warnings”: []}

I’m running Vagrant version: 2.0.2
and Virtualbox version: 5.2.6
Mac OS High Sierra

I manually added the IP Address to the file as:
192.168.50.5 example.test
192.168.50.5 www.example.test

and then run Vagrant Provision and it gets me to the “Welcome to NGINX” screen at this point but it doesn’t appear that it sees my WordPress Multisite database still. These might be 2 separate issues though.

Any thoughts on this initial error and the requirement to manually add the hosts file entry?

I also just experienced an ip address not being added to the etc/host file. The command “vagrant hostmanager” worked fine and updated etc/hosts as expected.

2 Likes