This repository was archived by the owner on Oct 5, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 253
Add support for vagrant-hostsupdater #137
Copy link
Copy link
Open
Description
Hi!
i'm currently testing vagrant-hostsupdater plugin, with this you don't need to manually update the your host file.
this is the code so far:
config.vm.hostname = "vagrant-lamp"
# Local Machine Hosts
#
# If the Vagrant plugin hostsupdater (https://github.com/cogitatio/vagrant-hostsupdater) is
# installed, the following will automatically configure your local machine's hosts file to
# be aware of the domains specified below. Watch the provisioning script as you may need to
# enter a password for Vagrant to access your hosts file.
#
# By default, we'll include all the domains located under the data_bags/sites directory.
#
if defined?(VagrantPlugins::HostsUpdater)
hosts = []
Dir.glob('data_bags/sites/*.json') do |json_file|
file = File.read(json_file)
data = JSON.parse(file)
hosts.push(data['host'])
end
# Pass the found host names to the hostsupdater plugin so it can perform magic.
config.hostsupdater.aliases = hosts
config.hostsupdater.remove_on_suspend = true
endany thoughts?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels