vagrant-group 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +51 -0
- data/lib/vagrant-group/command.rb +19 -6
- data/lib/vagrant-group/version.rb +1 -1
- metadata +2 -4
- data/lib/vagrant/vm/group/version.rb +0 -7
- data/lib/vagrant/vm/group.rb +0 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6a760544d3f71b0a17d173f8679fae04a8dc0128
|
4
|
+
data.tar.gz: 3e31e279fc715245f468d8d2c8a664a0a2abf3c3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 96a0ed8ac11d66a9e188d3b0aa0e2de8a7e0144ca4145b9e044d25826973d85d410c9d16666bbfccb910333afec1449ca574c72d00636627b160e62f81d20775
|
7
|
+
data.tar.gz: f701445d7c405c6972c2d77e133969ab3f1f665d13b2ac7e06370b6797c208cc3cc2e08fca7fb40995cc0c50746afb23860d582f87d926538aebf6b7a71b5cf4
|
data/README.md
CHANGED
@@ -1,7 +1,58 @@
|
|
1
1
|
# Vagrant Group Plugin
|
2
2
|
|
3
|
+
[](http://badge.fury.io/rb/vagrant-group)
|
4
|
+
|
3
5
|
With this plugin you can associate VMs to groups and then perform
|
4
6
|
basic operations like up/halt/provision/destroy on specific group.
|
7
|
+
One host may belong to multiple groups.
|
8
|
+
|
9
|
+
## How to install
|
10
|
+
|
11
|
+
```sh
|
12
|
+
vagrant plugin install vagrant-group
|
13
|
+
```
|
14
|
+
|
15
|
+
## How to configure
|
16
|
+
|
17
|
+
```ruby
|
18
|
+
Vagrant.configure("2") do |config|
|
19
|
+
config.vm.define "web1" do |web|
|
20
|
+
web.vm.box = "apache"
|
21
|
+
end
|
22
|
+
|
23
|
+
config.vm.define "web2" do |web|
|
24
|
+
web.vm.box = "apache"
|
25
|
+
end
|
26
|
+
|
27
|
+
config.vm.define "db1" do |db|
|
28
|
+
db.vm.box = "mysql"
|
29
|
+
end
|
30
|
+
|
31
|
+
config.vm.define "db2" do |db|
|
32
|
+
db.vm.box = "mysql"
|
33
|
+
end
|
34
|
+
|
35
|
+
config.group.groups = {
|
36
|
+
"webservers" => [ "web1", "web2" ],
|
37
|
+
"databases" => [ "db1", "db2" ]
|
38
|
+
}
|
39
|
+
end
|
40
|
+
```
|
41
|
+
|
42
|
+
## How to use
|
43
|
+
|
44
|
+
```sh
|
45
|
+
$ vagrant group webservers up
|
46
|
+
$ vagrant group databases halt
|
47
|
+
```
|
48
|
+
|
49
|
+
At the moment you use commands `up`, `halt`, `provision` and `destroy`.
|
50
|
+
Parameters are not supported.
|
51
|
+
|
52
|
+
In order to list hosts associated to group issue below command:
|
53
|
+
```
|
54
|
+
$ vagrant group webservers hosts
|
55
|
+
```
|
5
56
|
|
6
57
|
## Contributing
|
7
58
|
|
@@ -9,7 +9,7 @@ module VagrantPlugins
|
|
9
9
|
def execute
|
10
10
|
options = {}
|
11
11
|
opts = OptionParser.new do |o|
|
12
|
-
o.banner = 'Usage: vagrant group <group-name> <up|halt|destroy|provision>'
|
12
|
+
o.banner = 'Usage: vagrant group <group-name> <up|halt|destroy|provision|hosts>'
|
13
13
|
o.separator ''
|
14
14
|
|
15
15
|
o.on('-h', '--help', 'Print this help') do
|
@@ -21,15 +21,28 @@ module VagrantPlugins
|
|
21
21
|
|
22
22
|
group, action = argv[0], argv[1]
|
23
23
|
|
24
|
-
if !group || !action || !['up', 'halt', 'destroy', 'provision'].include?(action)
|
24
|
+
if !group || !action || !['up', 'halt', 'destroy', 'provision', 'hosts'].include?(action)
|
25
25
|
safe_puts(opts.help)
|
26
26
|
return nil
|
27
27
|
end
|
28
28
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
29
|
+
if action == 'hosts'
|
30
|
+
@env.ui.info(sprintf('Hosts in %s group:', group))
|
31
|
+
|
32
|
+
with_target_vms() do |machine|
|
33
|
+
if machine.config.group.groups.has_key?(group)
|
34
|
+
@env.ui.info(sprintf(' - %s', machine.name))
|
35
|
+
elsif
|
36
|
+
@env.ui.warn('No hosts associated.')
|
37
|
+
break
|
38
|
+
end
|
39
|
+
end
|
40
|
+
elsif
|
41
|
+
with_target_vms() do |machine|
|
42
|
+
if machine.config.group.groups.has_key?(group)
|
43
|
+
if machine.config.group.groups[group].include? machine.name.to_s
|
44
|
+
machine.action(action)
|
45
|
+
end
|
33
46
|
end
|
34
47
|
end
|
35
48
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vagrant-group
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Krzysztof Magosa
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-07-
|
11
|
+
date: 2015-07-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -55,8 +55,6 @@ files:
|
|
55
55
|
- lib/vagrant-group/config.rb
|
56
56
|
- lib/vagrant-group/plugin.rb
|
57
57
|
- lib/vagrant-group/version.rb
|
58
|
-
- lib/vagrant/vm/group.rb
|
59
|
-
- lib/vagrant/vm/group/version.rb
|
60
58
|
- vagrant-group.gemspec
|
61
59
|
homepage: ''
|
62
60
|
licenses:
|