Vagrant Group Plugin
With this plugin you can associate VMs to groups and then perform basic operations like up/halt/provision/destroy 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 webservers up
$ vagrant group databases halt
At the moment you use commands up, halt, provision and destroy.
Parameters are not supported.
In order to list hosts associated to group issue below command:
$ vagrant group webservers hosts
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