Add Hostmanager as a provisioner.
This commit is contained in:
parent
f058b3025f
commit
cae5f6be7d
11
README.md
11
README.md
|
@ -57,6 +57,17 @@ Vagrant.configure("2") do |config|
|
||||||
end
|
end
|
||||||
```
|
```
|
||||||
|
|
||||||
|
As a last option, you can also choose hostmanager as a provisioner.
|
||||||
|
This allows you to use the provisioning order to ensure that hostmanager
|
||||||
|
runs before or after provisioning. The provisioner will collect hosts from
|
||||||
|
boxes with the same provider as the running box.
|
||||||
|
|
||||||
|
Use:
|
||||||
|
|
||||||
|
```ruby
|
||||||
|
config.vm.provision :hostmanager
|
||||||
|
```
|
||||||
|
|
||||||
Contribute
|
Contribute
|
||||||
----------
|
----------
|
||||||
Contributions are welcome.
|
Contributions are welcome.
|
||||||
|
|
|
@ -7,6 +7,8 @@ module VagrantPlugins
|
||||||
description <<-DESC
|
description <<-DESC
|
||||||
This plugin manages the /etc/hosts file for guest machines. An entry is
|
This plugin manages the /etc/hosts file for guest machines. An entry is
|
||||||
created for each active machine using the hostname attribute.
|
created for each active machine using the hostname attribute.
|
||||||
|
|
||||||
|
You can also use the hostmanager provisioner to update the hosts file.
|
||||||
DESC
|
DESC
|
||||||
|
|
||||||
config(:hostmanager) do
|
config(:hostmanager) do
|
||||||
|
@ -22,6 +24,11 @@ module VagrantPlugins
|
||||||
hook.append(Action::UpdateHostsFile)
|
hook.append(Action::UpdateHostsFile)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
provisioner(:hostmanager) do
|
||||||
|
require_relative 'provisioner'
|
||||||
|
Provisioner
|
||||||
|
end
|
||||||
|
|
||||||
command(:hostmanager) do
|
command(:hostmanager) do
|
||||||
require_relative 'command'
|
require_relative 'command'
|
||||||
Command
|
Command
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
module VagrantPlugins
|
||||||
|
module HostManager
|
||||||
|
class Provisioner < Vagrant.plugin('2', :provisioner)
|
||||||
|
include HostsFile
|
||||||
|
|
||||||
|
def provision
|
||||||
|
generate(@machine.env, @machine.box.provider.to_sym)
|
||||||
|
update(@machine)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in New Issue