vagrant-flow 1.0.26 → 1.0.27
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 +18 -28
- data/lib/vagrant-flow/command/getDOtoken.rb +26 -0
- data/lib/vagrant-flow/command/hostfile.rb +4 -6
- data/lib/vagrant-flow/command/installDOToken.rb +88 -0
- data/lib/vagrant-flow/command/multiinit.rb +9 -0
- data/lib/vagrant-flow/command/root.rb +6 -0
- data/lib/vagrant-flow/version.rb +1 -1
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dc061965ed315eecc3e16616e72fbd129471dc64
|
4
|
+
data.tar.gz: 3d1ea1a4d6c64bf2100d99a25427096b20bc4483
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1c374f2cb3f3704bfdf4e679b59f4a396ff93de6641445653b39b8d5e219108c367227aa8424051b0d162e2460d7c712d0a57724857eccaef030f7d7dc0c5771
|
7
|
+
data.tar.gz: 0ea1608f46182c7627e461747c5f2d2a5c70c7f2360592050cdca184cbb49f29062530c1ea83ebc1d2715d8a7b1a9d253f9659b7d7c348579ff6b1cc5e060250
|
data/README.md
CHANGED
@@ -40,7 +40,8 @@ ansibleinventory
|
|
40
40
|
playbook
|
41
41
|
multicommand
|
42
42
|
```
|
43
|
-
|
43
|
+
- installdotoken
|
44
|
+
- Installs your digital ocean token to be able to use the digital ocean provider
|
44
45
|
- multiinit
|
45
46
|
- Creates a template Vagrantfile based on the machines you specify
|
46
47
|
- hostfile
|
@@ -55,6 +56,7 @@ multicommand
|
|
55
56
|
Example flow to be enabled
|
56
57
|
```
|
57
58
|
vagrant plugin install vagrant-flow
|
59
|
+
vagrant flow installdotoken -t xxxxxyyyyyyzzzz123
|
58
60
|
git clone http://github.com/DemandCube/DeveloperPlaybooks
|
59
61
|
mkdir devsetup
|
60
62
|
cd devsetup
|
@@ -85,6 +87,19 @@ Publically available boxes in vagrantcloud from DemandCube:
|
|
85
87
|
|
86
88
|
# Usage
|
87
89
|
|
90
|
+
* * *
|
91
|
+
##installdotoken
|
92
|
+
Usage: vagrant flow multicommand [-qf] -c COMMAND
|
93
|
+
Installs your digital ocean key for easy vagrant-flow configuration
|
94
|
+
|
95
|
+
-q, --quiet (Optional) Suppress output to STDOUT and STDERR
|
96
|
+
-t, --token TOKEN (REQUIRED) The token to install
|
97
|
+
-h, --help Print this help
|
98
|
+
|
99
|
+
Example: This will isntall your token to ~/.vagrant-flow for use in other plugins
|
100
|
+
```
|
101
|
+
vagrant flow installdotoken -t abcddefjdaj1243
|
102
|
+
```
|
88
103
|
|
89
104
|
* * *
|
90
105
|
## multiinit
|
@@ -158,11 +173,6 @@ Details on [vagrant-digitalocean](https://github.com/smdahlen/vagrant-digitaloce
|
|
158
173
|
:sshPrivateKeyPath: ~/.ssh/id_rsa
|
159
174
|
|
160
175
|
|
161
|
-
#The digitalOceanToken must be set for digitalocean to work. You can generate one at https://cloud.digitalocean.com/settings/applications
|
162
|
-
#Omit it if you don't want digitalocean as a provider option in your vagrantfile
|
163
|
-
:digitalOceanToken: xxxxxxxxxxxxxxyyyyyyyzzzzz988765445678765
|
164
|
-
|
165
|
-
|
166
176
|
:intnetName: neverwinterDP
|
167
177
|
machines:
|
168
178
|
#Create a box with all defaults set for you
|
@@ -215,32 +225,12 @@ This will look through your vagrantfile config, find all the hostnames and IP's
|
|
215
225
|
vagrant flow hostfile
|
216
226
|
```
|
217
227
|
|
218
|
-
This will make an API call to digital ocean (https://developers.digitalocean.com/droplets/), retrieve your list of hostnames and Ip's, and append that information retrieved from DO to the VM's hosts file specified in your Vagrantfile.
|
228
|
+
This will make an API call to digital ocean (https://developers.digitalocean.com/droplets/), retrieve your list of hostnames and Ip's, and append that information retrieved from DO to the VM's hosts file specified in your Vagrantfile.
|
229
|
+
This option requires you first run vagrant flow installdotoken -t [your token here]
|
219
230
|
```
|
220
231
|
vagrant flow hostfile -d
|
221
232
|
```
|
222
233
|
|
223
|
-
Example Vagrantfile excerpt. This configuration is required by hostfile to be able to determine IP addresses and hostnames.
|
224
|
-
If you're already using vagrant flow multiinit, then this configuration is already take care of
|
225
|
-
```
|
226
|
-
config.vm.define :server1 do | server1 |
|
227
|
-
server1.vm.box = "demandcube/centos-65_x86_64-VB-4.3.8"
|
228
|
-
# Create a private network
|
229
|
-
server1.vm.network :private_network, ip: "192.168.1.2", virtualbox__intnet: "neverwinterDP"
|
230
|
-
server1.vm.hostname = "server1"
|
231
|
-
end
|
232
|
-
|
233
|
-
config.vm.define :server2 do | server2 |
|
234
|
-
server2.vm.box = "demandcube/centos-65_x86_64-VB-4.3.8"
|
235
|
-
# Create a private network
|
236
|
-
server2.vm.network :private_network, ip: "192.168.1.3", virtualbox__intnet: "neverwinterDP"
|
237
|
-
server2.vm.hostname = "server2"
|
238
|
-
end
|
239
|
-
```
|
240
|
-
|
241
|
-
Refer to multiinit for how to set your digital ocean token
|
242
|
-
To find your digital ocean token, log into digital ocean, and visit https://cloud.digitalocean.com/api_access
|
243
|
-
|
244
234
|
* * *
|
245
235
|
## ansibleinventory
|
246
236
|
```
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'yaml'
|
2
|
+
|
3
|
+
##Example usage:
|
4
|
+
##Require my library for talking to digitalocean
|
5
|
+
##require File.expand_path(File.dirname(__FILE__) ) +"/getDOToken"
|
6
|
+
##puts GetDOToken.getToken()
|
7
|
+
|
8
|
+
class GetDOToken
|
9
|
+
|
10
|
+
#Returns digital ocean token that's been installed
|
11
|
+
#Returns nil if its not present
|
12
|
+
def self.getToken()
|
13
|
+
filename = ENV['HOME']+"/.vagrant-flow"
|
14
|
+
if File.exists?(filename)
|
15
|
+
x = YAML::load_file(filename)
|
16
|
+
if x.has_key?(:digitalOceanToken)
|
17
|
+
return x[:digitalOceanToken]
|
18
|
+
end
|
19
|
+
end
|
20
|
+
return nil
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
|
25
|
+
|
26
|
+
|
@@ -6,6 +6,9 @@ require 'yaml'
|
|
6
6
|
#Require my library for talking to digitalocean
|
7
7
|
require File.expand_path(File.dirname(__FILE__) ) +"/digitalocean_api"
|
8
8
|
|
9
|
+
#Require my library for grabbing installed DO Token
|
10
|
+
require File.expand_path(File.dirname(__FILE__) ) +"/getDOToken"
|
11
|
+
|
9
12
|
module VagrantPlugins
|
10
13
|
module CommandVagrantFlow
|
11
14
|
module Command
|
@@ -30,7 +33,6 @@ module VagrantPlugins
|
|
30
33
|
options[:nowrite] = false
|
31
34
|
options[:quiet] = false
|
32
35
|
options[:digitalocean] = false
|
33
|
-
options[:digitalocean_file] = "multiinitconfig.yml"
|
34
36
|
|
35
37
|
#Parse option, look up OptionParser documentation
|
36
38
|
opts = OptionParser.new do |o|
|
@@ -52,9 +54,6 @@ module VagrantPlugins
|
|
52
54
|
options[:digitalocean] = true
|
53
55
|
end
|
54
56
|
|
55
|
-
o.on("-o", "--digitaloceanfile FILE", "(Optional) File to read in for -d option instead of multiinitconfig.yml") do |f|
|
56
|
-
options[:digitalocean_file] = f
|
57
|
-
end
|
58
57
|
end
|
59
58
|
argv = parse_options(opts)
|
60
59
|
return if !argv
|
@@ -65,9 +64,8 @@ module VagrantPlugins
|
|
65
64
|
#Go through config
|
66
65
|
#Map hostnames to IP's
|
67
66
|
if options[:digitalocean]
|
68
|
-
config = YAML.load_file(options[:digitalocean_file])
|
69
67
|
digitalocean = DigitalOcean_Api.new()
|
70
|
-
hostinfo = digitalocean.getHostNamesAndIps(
|
68
|
+
hostinfo = digitalocean.getHostNamesAndIps(GetDOToken.getToken())
|
71
69
|
else
|
72
70
|
with_target_vms(argv, :provider => options[:provider]) do |machine|
|
73
71
|
return unless machine.communicate.ready?
|
@@ -0,0 +1,88 @@
|
|
1
|
+
require "vagrant"
|
2
|
+
require 'optparse'
|
3
|
+
require 'yaml'
|
4
|
+
|
5
|
+
|
6
|
+
module VagrantPlugins
|
7
|
+
module CommandVagrantFlow
|
8
|
+
module Command
|
9
|
+
class InstallDOToken < Vagrant.plugin("2", :command)
|
10
|
+
|
11
|
+
# Builtin from Command class
|
12
|
+
# Must override to provide a description
|
13
|
+
def self.synopsis
|
14
|
+
"Installs your digital ocean key to ~/.vagrant-flow"
|
15
|
+
end
|
16
|
+
|
17
|
+
def commandThread(machine,command, quiet)
|
18
|
+
begin
|
19
|
+
machine.communicate.execute(command)
|
20
|
+
if !quiet
|
21
|
+
puts "Command was ran successfully on: "+machine.config.vm.hostname
|
22
|
+
end
|
23
|
+
rescue
|
24
|
+
if !quiet
|
25
|
+
puts "Command FAILED on: "+machine.config.vm.hostname
|
26
|
+
@error_message="#{$!}"
|
27
|
+
puts @error_message
|
28
|
+
end
|
29
|
+
ensure
|
30
|
+
if !quiet
|
31
|
+
puts "----"
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
# Builtin from Command class
|
37
|
+
# Must override to provide core functionality
|
38
|
+
def execute
|
39
|
+
options = {}
|
40
|
+
options[:destroy_on_error] = true
|
41
|
+
options[:parallel] = false
|
42
|
+
options[:provision_ignore_sentinel] = false
|
43
|
+
options[:quiet] = false
|
44
|
+
options[:token] = nil
|
45
|
+
|
46
|
+
opts = OptionParser.new do |o|
|
47
|
+
o.banner = "A NeverWinterDP technology from the Department of Badass.\n\n"+
|
48
|
+
"Usage: vagrant flow multicommand [-q] -t TOKEN\n"+
|
49
|
+
"Installs your digital ocean key for easy vagrant-flow configuration"
|
50
|
+
o.separator ""
|
51
|
+
|
52
|
+
o.on("-q", "--quiet", "(Optional) Suppress output to STDOUT and STDERR") do |f|
|
53
|
+
options[:quiet] = true
|
54
|
+
end
|
55
|
+
|
56
|
+
o.on("-t", "--token TOKEN", "(REQUIRED) The token to install") do |f|
|
57
|
+
options[:token] = f
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
argv = parse_options(opts)
|
62
|
+
return if !argv
|
63
|
+
raise OptionParser::MissingArgument if options[:token].nil?
|
64
|
+
x = {
|
65
|
+
:digitalOceanToken=>options[:token],
|
66
|
+
}
|
67
|
+
|
68
|
+
filename = ENV['HOME']+"/.vagrant-flow"
|
69
|
+
begin
|
70
|
+
File.open(filename, 'w') { |file| file.write (x.to_yaml ) }
|
71
|
+
if !options[:quiet]
|
72
|
+
puts "Success!"
|
73
|
+
end
|
74
|
+
rescue
|
75
|
+
if !options[:quiet]
|
76
|
+
@error_message="#{$!}"
|
77
|
+
$stderr.puts "Could not write to "+filename
|
78
|
+
$stderr.puts @error_message
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
@@ -4,6 +4,9 @@ require "yaml"
|
|
4
4
|
require 'erubis'
|
5
5
|
require "ipaddr"
|
6
6
|
|
7
|
+
#Require my library for grabbing installed DO Token
|
8
|
+
require File.expand_path(File.dirname(__FILE__) ) +"/getDOToken"
|
9
|
+
|
7
10
|
module VagrantPlugins
|
8
11
|
module CommandVagrantFlow
|
9
12
|
module Command
|
@@ -138,6 +141,12 @@ module VagrantPlugins
|
|
138
141
|
return
|
139
142
|
end
|
140
143
|
|
144
|
+
#Set digitalocean token if its installed
|
145
|
+
token= GetDOToken.getToken()
|
146
|
+
if ! token.nil?
|
147
|
+
content[:digitalOceanToken] = token
|
148
|
+
end
|
149
|
+
|
141
150
|
#Set IP's for private network
|
142
151
|
#Start at 192.168.1.0 and increment up
|
143
152
|
#using the IPAddr class
|
data/lib/vagrant-flow/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vagrant-flow
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.27
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Steve Morin
|
@@ -59,7 +59,9 @@ files:
|
|
59
59
|
- lib/vagrant-flow.rb
|
60
60
|
- lib/vagrant-flow/command/ansibleinventory.rb
|
61
61
|
- lib/vagrant-flow/command/digitalocean_api.rb
|
62
|
+
- lib/vagrant-flow/command/getDOtoken.rb
|
62
63
|
- lib/vagrant-flow/command/hostfile.rb
|
64
|
+
- lib/vagrant-flow/command/installDOToken.rb
|
63
65
|
- lib/vagrant-flow/command/multicommand.rb
|
64
66
|
- lib/vagrant-flow/command/multiinit.rb
|
65
67
|
- lib/vagrant-flow/command/playbook.rb
|