Vagrant Group Plugin
With this plugin you can associate VMs to groups and then perform basic operations like up/halt/provision/destroy/reload on specific group. One host may belong to multiple groups.
How to install
vagrant plugin install vagrant-group
How to configure
Vagrant.configure("2") do |config|
config.vm.define "web1" do |web|
web.vm.box = "apache"
end
config.vm.define "web2" do |web|
web.vm.box = "apache"
end
config.vm.define "db1" do |db|
db.vm.box = "mysql"
end
config.vm.define "db2" do |db|
db.vm.box = "mysql"
end
config.group.groups = {
"webservers" => [ "web1", "web2" ],
"databases" => [ "db1", "db2" ]
}
end
How to use
$ vagrant group up webservers
$ vagrant group halt databases
At the moment you use commands up
, halt
, provision
, reload
, suspend
, resume
and destroy
.
Parameters are not supported except --force
in halt
and destroy
commands.
In order to list hosts associated to group issue below command:
$ vagrant group hosts webservers
Contributing
- Fork it ( https://github.com/krzysztof-magosa/vagrant-group/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request