vagrant-yarrs-and-yamls 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: a25067043b1d835af5cafe974baa435937ec6f3e
4
+ data.tar.gz: 6c7d65f8e6b4e9a72659ea76f25f43826454ce22
5
+ SHA512:
6
+ metadata.gz: bfb223ea8ea6a283d857a1fc9f178ab31d8a3d5baa66c6e1a1e2a6ceaea8d84c292f8e2fe1243046d0662429a800a564dc75b62370a316e1774d349c5404f871
7
+ data.tar.gz: 271d74e280a96ee576236232b295caabe377f6133e36f3cd396603c93ec73eb90d2bb11357cee18b50b12bd23281e44d59245ec006e8ee6e06358196c3ed8cd8
data/.gitignore ADDED
@@ -0,0 +1,20 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
18
+ .idea
19
+ *.swp
20
+ .vagrant
data/Gemfile ADDED
@@ -0,0 +1,13 @@
1
+ source "https://rubygems.org"
2
+
3
+ gem "rake"
4
+
5
+ group :development do
6
+ gem "vagrant", git: "https://github.com/mitchellh/vagrant.git"
7
+ end
8
+
9
+ group :plugins do
10
+ gem "vagrant-yarrs-and-yamls", path: "."
11
+ gem "vagrant-digitalocean"
12
+ gem "vagrant-aws"
13
+ end
data/LICENSE.txt ADDED
@@ -0,0 +1,341 @@
1
+ Copyright (c) 2015 Ptah Dunbar
2
+
3
+ GNU GENERAL PUBLIC LICENSE
4
+ Version 2, June 1991
5
+
6
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
7
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
8
+ Everyone is permitted to copy and distribute verbatim copies
9
+ of this license document, but changing it is not allowed.
10
+
11
+ Preamble
12
+
13
+ The licenses for most software are designed to take away your
14
+ freedom to share and change it. By contrast, the GNU General Public
15
+ License is intended to guarantee your freedom to share and change free
16
+ software--to make sure the software is free for all its users. This
17
+ General Public License applies to most of the Free Software
18
+ Foundation's software and to any other program whose authors commit to
19
+ using it. (Some other Free Software Foundation software is covered by
20
+ the GNU Lesser General Public License instead.) You can apply it to
21
+ your programs, too.
22
+
23
+ When we speak of free software, we are referring to freedom, not
24
+ price. Our General Public Licenses are designed to make sure that you
25
+ have the freedom to distribute copies of free software (and charge for
26
+ this service if you wish), that you receive source code or can get it
27
+ if you want it, that you can change the software or use pieces of it
28
+ in new free programs; and that you know you can do these things.
29
+
30
+ To protect your rights, we need to make restrictions that forbid
31
+ anyone to deny you these rights or to ask you to surrender the rights.
32
+ These restrictions translate to certain responsibilities for you if you
33
+ distribute copies of the software, or if you modify it.
34
+
35
+ For example, if you distribute copies of such a program, whether
36
+ gratis or for a fee, you must give the recipients all the rights that
37
+ you have. You must make sure that they, too, receive or can get the
38
+ source code. And you must show them these terms so they know their
39
+ rights.
40
+
41
+ We protect your rights with two steps: (1) copyright the software, and
42
+ (2) offer you this license which gives you legal permission to copy,
43
+ distribute and/or modify the software.
44
+
45
+ Also, for each author's protection and ours, we want to make certain
46
+ that everyone understands that there is no warranty for this free
47
+ software. If the software is modified by someone else and passed on, we
48
+ want its recipients to know that what they have is not the original, so
49
+ that any problems introduced by others will not reflect on the original
50
+ authors' reputations.
51
+
52
+ Finally, any free program is threatened constantly by software
53
+ patents. We wish to avoid the danger that redistributors of a free
54
+ program will individually obtain patent licenses, in effect making the
55
+ program proprietary. To prevent this, we have made it clear that any
56
+ patent must be licensed for everyone's free use or not licensed at all.
57
+
58
+ The precise terms and conditions for copying, distribution and
59
+ modification follow.
60
+
61
+ GNU GENERAL PUBLIC LICENSE
62
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
63
+
64
+ 0. This License applies to any program or other work which contains
65
+ a notice placed by the copyright holder saying it may be distributed
66
+ under the terms of this General Public License. The "Program", below,
67
+ refers to any such program or work, and a "work based on the Program"
68
+ means either the Program or any derivative work under copyright law:
69
+ that is to say, a work containing the Program or a portion of it,
70
+ either verbatim or with modifications and/or translated into another
71
+ language. (Hereinafter, translation is included without limitation in
72
+ the term "modification".) Each licensee is addressed as "you".
73
+
74
+ Activities other than copying, distribution and modification are not
75
+ covered by this License; they are outside its scope. The act of
76
+ running the Program is not restricted, and the output from the Program
77
+ is covered only if its contents constitute a work based on the
78
+ Program (independent of having been made by running the Program).
79
+ Whether that is true depends on what the Program does.
80
+
81
+ 1. You may copy and distribute verbatim copies of the Program's
82
+ source code as you receive it, in any medium, provided that you
83
+ conspicuously and appropriately publish on each copy an appropriate
84
+ copyright notice and disclaimer of warranty; keep intact all the
85
+ notices that refer to this License and to the absence of any warranty;
86
+ and give any other recipients of the Program a copy of this License
87
+ along with the Program.
88
+
89
+ You may charge a fee for the physical act of transferring a copy, and
90
+ you may at your option offer warranty protection in exchange for a fee.
91
+
92
+ 2. You may modify your copy or copies of the Program or any portion
93
+ of it, thus forming a work based on the Program, and copy and
94
+ distribute such modifications or work under the terms of Section 1
95
+ above, provided that you also meet all of these conditions:
96
+
97
+ a) You must cause the modified files to carry prominent notices
98
+ stating that you changed the files and the date of any change.
99
+
100
+ b) You must cause any work that you distribute or publish, that in
101
+ whole or in part contains or is derived from the Program or any
102
+ part thereof, to be licensed as a whole at no charge to all third
103
+ parties under the terms of this License.
104
+
105
+ c) If the modified program normally reads commands interactively
106
+ when run, you must cause it, when started running for such
107
+ interactive use in the most ordinary way, to print or display an
108
+ announcement including an appropriate copyright notice and a
109
+ notice that there is no warranty (or else, saying that you provide
110
+ a warranty) and that users may redistribute the program under
111
+ these conditions, and telling the user how to view a copy of this
112
+ License. (Exception: if the Program itself is interactive but
113
+ does not normally print such an announcement, your work based on
114
+ the Program is not required to print an announcement.)
115
+
116
+ These requirements apply to the modified work as a whole. If
117
+ identifiable sections of that work are not derived from the Program,
118
+ and can be reasonably considered independent and separate works in
119
+ themselves, then this License, and its terms, do not apply to those
120
+ sections when you distribute them as separate works. But when you
121
+ distribute the same sections as part of a whole which is a work based
122
+ on the Program, the distribution of the whole must be on the terms of
123
+ this License, whose permissions for other licensees extend to the
124
+ entire whole, and thus to each and every part regardless of who wrote it.
125
+
126
+ Thus, it is not the intent of this section to claim rights or contest
127
+ your rights to work written entirely by you; rather, the intent is to
128
+ exercise the right to control the distribution of derivative or
129
+ collective works based on the Program.
130
+
131
+ In addition, mere aggregation of another work not based on the Program
132
+ with the Program (or with a work based on the Program) on a volume of
133
+ a storage or distribution medium does not bring the other work under
134
+ the scope of this License.
135
+
136
+ 3. You may copy and distribute the Program (or a work based on it,
137
+ under Section 2) in object code or executable form under the terms of
138
+ Sections 1 and 2 above provided that you also do one of the following:
139
+
140
+ a) Accompany it with the complete corresponding machine-readable
141
+ source code, which must be distributed under the terms of Sections
142
+ 1 and 2 above on a medium customarily used for software interchange; or,
143
+
144
+ b) Accompany it with a written offer, valid for at least three
145
+ years, to give any third party, for a charge no more than your
146
+ cost of physically performing source distribution, a complete
147
+ machine-readable copy of the corresponding source code, to be
148
+ distributed under the terms of Sections 1 and 2 above on a medium
149
+ customarily used for software interchange; or,
150
+
151
+ c) Accompany it with the information you received as to the offer
152
+ to distribute corresponding source code. (This alternative is
153
+ allowed only for noncommercial distribution and only if you
154
+ received the program in object code or executable form with such
155
+ an offer, in accord with Subsection b above.)
156
+
157
+ The source code for a work means the preferred form of the work for
158
+ making modifications to it. For an executable work, complete source
159
+ code means all the source code for all modules it contains, plus any
160
+ associated interface definition files, plus the scripts used to
161
+ control compilation and installation of the executable. However, as a
162
+ special exception, the source code distributed need not include
163
+ anything that is normally distributed (in either source or binary
164
+ form) with the major components (compiler, kernel, and so on) of the
165
+ operating system on which the executable runs, unless that component
166
+ itself accompanies the executable.
167
+
168
+ If distribution of executable or object code is made by offering
169
+ access to copy from a designated place, then offering equivalent
170
+ access to copy the source code from the same place counts as
171
+ distribution of the source code, even though third parties are not
172
+ compelled to copy the source along with the object code.
173
+
174
+ 4. You may not copy, modify, sublicense, or distribute the Program
175
+ except as expressly provided under this License. Any attempt
176
+ otherwise to copy, modify, sublicense or distribute the Program is
177
+ void, and will automatically terminate your rights under this License.
178
+ However, parties who have received copies, or rights, from you under
179
+ this License will not have their licenses terminated so long as such
180
+ parties remain in full compliance.
181
+
182
+ 5. You are not required to accept this License, since you have not
183
+ signed it. However, nothing else grants you permission to modify or
184
+ distribute the Program or its derivative works. These actions are
185
+ prohibited by law if you do not accept this License. Therefore, by
186
+ modifying or distributing the Program (or any work based on the
187
+ Program), you indicate your acceptance of this License to do so, and
188
+ all its terms and conditions for copying, distributing or modifying
189
+ the Program or works based on it.
190
+
191
+ 6. Each time you redistribute the Program (or any work based on the
192
+ Program), the recipient automatically receives a license from the
193
+ original licensor to copy, distribute or modify the Program subject to
194
+ these terms and conditions. You may not impose any further
195
+ restrictions on the recipients' exercise of the rights granted herein.
196
+ You are not responsible for enforcing compliance by third parties to
197
+ this License.
198
+
199
+ 7. If, as a consequence of a court judgment or allegation of patent
200
+ infringement or for any other reason (not limited to patent issues),
201
+ conditions are imposed on you (whether by court order, agreement or
202
+ otherwise) that contradict the conditions of this License, they do not
203
+ excuse you from the conditions of this License. If you cannot
204
+ distribute so as to satisfy simultaneously your obligations under this
205
+ License and any other pertinent obligations, then as a consequence you
206
+ may not distribute the Program at all. For example, if a patent
207
+ license would not permit royalty-free redistribution of the Program by
208
+ all those who receive copies directly or indirectly through you, then
209
+ the only way you could satisfy both it and this License would be to
210
+ refrain entirely from distribution of the Program.
211
+
212
+ If any portion of this section is held invalid or unenforceable under
213
+ any particular circumstance, the balance of the section is intended to
214
+ apply and the section as a whole is intended to apply in other
215
+ circumstances.
216
+
217
+ It is not the purpose of this section to induce you to infringe any
218
+ patents or other property right claims or to contest validity of any
219
+ such claims; this section has the sole purpose of protecting the
220
+ integrity of the free software distribution system, which is
221
+ implemented by public license practices. Many people have made
222
+ generous contributions to the wide range of software distributed
223
+ through that system in reliance on consistent application of that
224
+ system; it is up to the author/donor to decide if he or she is willing
225
+ to distribute software through any other system and a licensee cannot
226
+ impose that choice.
227
+
228
+ This section is intended to make thoroughly clear what is believed to
229
+ be a consequence of the rest of this License.
230
+
231
+ 8. If the distribution and/or use of the Program is restricted in
232
+ certain countries either by patents or by copyrighted interfaces, the
233
+ original copyright holder who places the Program under this License
234
+ may add an explicit geographical distribution limitation excluding
235
+ those countries, so that distribution is permitted only in or among
236
+ countries not thus excluded. In such case, this License incorporates
237
+ the limitation as if written in the body of this License.
238
+
239
+ 9. The Free Software Foundation may publish revised and/or new versions
240
+ of the General Public License from time to time. Such new versions will
241
+ be similar in spirit to the present version, but may differ in detail to
242
+ address new problems or concerns.
243
+
244
+ Each version is given a distinguishing version number. If the Program
245
+ specifies a version number of this License which applies to it and "any
246
+ later version", you have the option of following the terms and conditions
247
+ either of that version or of any later version published by the Free
248
+ Software Foundation. If the Program does not specify a version number of
249
+ this License, you may choose any version ever published by the Free Software
250
+ Foundation.
251
+
252
+ 10. If you wish to incorporate parts of the Program into other free
253
+ programs whose distribution conditions are different, write to the author
254
+ to ask for permission. For software which is copyrighted by the Free
255
+ Software Foundation, write to the Free Software Foundation; we sometimes
256
+ make exceptions for this. Our decision will be guided by the two goals
257
+ of preserving the free status of all derivatives of our free software and
258
+ of promoting the sharing and reuse of software generally.
259
+
260
+ NO WARRANTY
261
+
262
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
263
+ FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
264
+ OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
265
+ PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
266
+ OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
267
+ MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
268
+ TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
269
+ PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
270
+ REPAIR OR CORRECTION.
271
+
272
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
273
+ WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
274
+ REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
275
+ INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
276
+ OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
277
+ TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
278
+ YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
279
+ PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
280
+ POSSIBILITY OF SUCH DAMAGES.
281
+
282
+ END OF TERMS AND CONDITIONS
283
+
284
+ How to Apply These Terms to Your New Programs
285
+
286
+ If you develop a new program, and you want it to be of the greatest
287
+ possible use to the public, the best way to achieve this is to make it
288
+ free software which everyone can redistribute and change under these terms.
289
+
290
+ To do so, attach the following notices to the program. It is safest
291
+ to attach them to the start of each source file to most effectively
292
+ convey the exclusion of warranty; and each file should have at least
293
+ the "copyright" line and a pointer to where the full notice is found.
294
+
295
+ <one line to give the program's name and a brief idea of what it does.>
296
+ Copyright (C) <year> <name of author>
297
+
298
+ This program is free software; you can redistribute it and/or modify
299
+ it under the terms of the GNU General Public License as published by
300
+ the Free Software Foundation; either version 2 of the License, or
301
+ (at your option) any later version.
302
+
303
+ This program is distributed in the hope that it will be useful,
304
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
305
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
306
+ GNU General Public License for more details.
307
+
308
+ You should have received a copy of the GNU General Public License along
309
+ with this program; if not, write to the Free Software Foundation, Inc.,
310
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
311
+
312
+ Also add information on how to contact you by electronic and paper mail.
313
+
314
+ If the program is interactive, make it output a short notice like this
315
+ when it starts in an interactive mode:
316
+
317
+ Gnomovision version 69, Copyright (C) year name of author
318
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
319
+ This is free software, and you are welcome to redistribute it
320
+ under certain conditions; type `show c' for details.
321
+
322
+ The hypothetical commands `show w' and `show c' should show the appropriate
323
+ parts of the General Public License. Of course, the commands you use may
324
+ be called something other than `show w' and `show c'; they could even be
325
+ mouse-clicks or menu items--whatever suits your program.
326
+
327
+ You should also get your employer (if you work as a programmer) or your
328
+ school, if any, to sign a "copyright disclaimer" for the program, if
329
+ necessary. Here is a sample; alter the names:
330
+
331
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
332
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
333
+
334
+ <signature of Ty Coon>, 1 April 1989
335
+ Ty Coon, President of Vice
336
+
337
+ This General Public License does not permit incorporating your program into
338
+ proprietary programs. If your program is a subroutine library, you may
339
+ consider it more useful to permit linking proprietary applications with the
340
+ library. If this is what you want to do, use the GNU Lesser General
341
+ Public License instead of this License.
data/README.md ADDED
@@ -0,0 +1,24 @@
1
+ # Yarrs And Yamls
2
+
3
+ ## Installation
4
+
5
+ `vagrant plugin install vagrant-yarrs-and-yamls`
6
+
7
+ ## Usage
8
+
9
+ Replace your Vagrantfile with:
10
+ ```
11
+ Vagrant.configure(2) do |config|
12
+ yarrs_and_yamls(config)
13
+ end
14
+ ```
15
+
16
+ Create a new file named `Vagrantfile.yml`
17
+
18
+ ## Contributing
19
+
20
+ 1. Fork it
21
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
22
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
23
+ 4. Push to the branch (`git push origin my-new-feature`)
24
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,3 @@
1
+ require 'rubygems'
2
+ require 'bundler/setup'
3
+ Bundler::GemHelper.install_tasks
data/Vagrantfile ADDED
@@ -0,0 +1,71 @@
1
+ # -*- mode: ruby -*-
2
+ # vi: set ft=ruby :
3
+
4
+ # All Vagrant configuration is done below. The "2" in Vagrant.configure
5
+ # configures the configuration version (we support older styles for
6
+ # backwards compatibility). Please don't change it unless you know what
7
+ # you're doing.
8
+ Vagrant.configure(2) do |config|
9
+ # The most common configuration options are documented and commented below.
10
+ # For a complete reference, please see the online documentation at
11
+ # https://docs.vagrantup.com.
12
+
13
+ # Every Vagrant development environment requires a box. You can search for
14
+ # boxes at https://atlas.hashicorp.com/search.
15
+ config.vm.box = "base"
16
+
17
+ # Disable automatic box update checking. If you disable this, then
18
+ # boxes will only be checked for updates when the user runs
19
+ # `vagrant box outdated`. This is not recommended.
20
+ # config.vm.box_check_update = false
21
+
22
+ # Create a forwarded port mapping which allows access to a specific port
23
+ # within the machine from a port on the host machine. In the example below,
24
+ # accessing "localhost:8080" will access port 80 on the guest machine.
25
+ # config.vm.network "forwarded_port", guest: 80, host: 8080
26
+
27
+ # Create a private network, which allows host-only access to the machine
28
+ # using a specific IP.
29
+ # config.vm.network "private_network", ip: "192.168.33.10"
30
+
31
+ # Create a public network, which generally matched to bridged network.
32
+ # Bridged networks make the machine appear as another physical device on
33
+ # your network.
34
+ # config.vm.network "public_network"
35
+
36
+ # Share an additional folder to the guest VM. The first argument is
37
+ # the path on the host to the actual folder. The second argument is
38
+ # the path on the guest to mount the folder. And the optional third
39
+ # argument is a set of non-required options.
40
+ # config.vm.synced_folder "../data", "/vagrant_data"
41
+
42
+ # Provider-specific configuration so you can fine-tune various
43
+ # backing providers for Vagrant. These expose provider-specific options.
44
+ # Example for VirtualBox:
45
+ #
46
+ # config.vm.provider "virtualbox" do |vb|
47
+ # # Display the VirtualBox GUI when booting the machine
48
+ # vb.gui = true
49
+ #
50
+ # # Customize the amount of memory on the VM:
51
+ # vb.memory = "1024"
52
+ # end
53
+ #
54
+ # View the documentation for the provider you are using for more
55
+ # information on available options.
56
+
57
+ # Define a Vagrant Push strategy for pushing to Atlas. Other push strategies
58
+ # such as FTP and Heroku are also available. See the documentation at
59
+ # https://docs.vagrantup.com/v2/push/atlas.html for more information.
60
+ # config.push.define "atlas" do |push|
61
+ # push.app = "YOUR_ATLAS_USERNAME/YOUR_APPLICATION_NAME"
62
+ # end
63
+
64
+ # Enable provisioning with a shell script. Additional provisioners such as
65
+ # Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the
66
+ # documentation for more information about their specific syntax and use.
67
+ # config.vm.provision "shell", inline: <<-SHELL
68
+ # sudo apt-get update
69
+ # sudo apt-get install -y apache2
70
+ # SHELL
71
+ end
@@ -0,0 +1,10 @@
1
+ # -*- mode: ruby -*-
2
+ # vi: set ft=ruby :
3
+
4
+ # All Vagrant configuration is done below. The "2" in Vagrant.configure
5
+ # configures the configuration version (we support older styles for
6
+ # backwards compatibility). Please don't change it unless you know what
7
+ # you're doing.
8
+ Vagrant.configure(2) do |config|
9
+ yarrs_and_yamls(config)
10
+ end
@@ -0,0 +1,4 @@
1
+ ---
2
+ boxes:
3
+ - hostname: coreos-34
4
+ box: ubuntu/trusty64
@@ -0,0 +1,58 @@
1
+ require "vagrant"
2
+ require "yaml"
3
+ require_relative "v1"
4
+
5
+ module VagrantPlugins
6
+ module YarrsAndYamls
7
+ class Plugin < Vagrant.plugin(2)
8
+ name "vagrant-yarrs-and-yamls"
9
+
10
+ @@config = false
11
+
12
+ action_hook(:load_config, Plugin::ALL_ACTIONS) { load_config }
13
+
14
+ action_hook(:require_vagrant_plugins, :environment_load) {
15
+ if ! self.get_config.empty?
16
+ self.require_vagrant_plugins(self.get_config["required_plugins"]) if self.get_config["required_plugins"]
17
+ end
18
+ }
19
+
20
+ def self.load_config
21
+
22
+ return @@config if @@config
23
+
24
+ @@config = []
25
+ configfile = ''
26
+
27
+ # Try Vagrant.local.yml next
28
+ if File.exists? "Vagrantfile.local.yml"
29
+ configfile = "Vagrantfile.local.yml"
30
+ elsif File.exists? "Vagrantfile.yml"
31
+ configfile = "Vagrantfile.yml"
32
+ end
33
+
34
+ # pass in a configfile to load.
35
+ ARGV.each do |arg|
36
+ if arg.include?('--config=')
37
+ configfile = arg.gsub('--config=', '')
38
+ end
39
+ end
40
+
41
+ #puts "configfile: #{configfile}"
42
+ if File.exists? configfile
43
+ @@config = YAML.load_file(configfile);
44
+ end
45
+ end
46
+
47
+ def self.get_config
48
+ @@config
49
+ end
50
+
51
+ def self.require_vagrant_plugins(plugins)
52
+ plugins.each do |plugin|
53
+ system "vagrant plugin install #{plugin}" unless Vagrant.has_plugin? plugin
54
+ end
55
+ end
56
+ end
57
+ end
58
+ end
@@ -0,0 +1,231 @@
1
+
2
+ def yarrs_and_yamls(config=nil)
3
+ raise 'Missing required parameter. yarrs_and_yamls(config)' if ! config
4
+
5
+ vfile = VagrantPlugins::YarrsAndYamls::Plugin.get_config
6
+
7
+ boxes = get_nodes(vfile)
8
+
9
+ boxes.each do |hostname, box|
10
+ config.vm.define hostname do |node|
11
+ node.vm.box = box["box"]
12
+ node.vm.box_url = box["box_url"]
13
+ node.vm.box_check_update = box["box_check_update"]
14
+ node.vm.boot_timeout = box["boot_timeout"]
15
+ node.vm.box_download_checksum = box["box_download_checksum"]
16
+ node.vm.box_download_checksum_type = box["box_download_checksum_type"]
17
+ node.vm.box_download_client_cert = box["box_download_client_cert"]
18
+ node.vm.box_download_ca_cert = box["box_download_ca_cert"]
19
+ node.vm.box_download_ca_path = box["box_download_ca_path"]
20
+ node.vm.box_download_insecure = box["box_download_insecure"]
21
+ node.vm.box_version = box["box_version"]
22
+ node.vm.communicator = box["communicator"]
23
+ node.vm.graceful_halt_timeout = box["graceful_halt_timeout"]
24
+ node.vm.guest = box["guest"]
25
+ node.vm.post_up_message = box["post_up_message"]
26
+ node.vm.usable_port_range = box["usable_port_range"]
27
+
28
+ node.vm.network "private_network", ip: box["ip"], :netmask => "255.255.255.0" if box["ip"]
29
+
30
+ if box["forwarded_ports"]
31
+ box["forwarded_ports"].each do |port|
32
+ node.vm.network "forwarded_port", guest: port["guest"], host: port["host"]
33
+ end
34
+ end
35
+
36
+ if box["synced_folders"]
37
+ box["synced_folders"].each do |folder|
38
+ node.vm.synced_folder folder[:host], folder[:guest], folder[:args]
39
+ end
40
+ end
41
+
42
+ if box["ssh"]
43
+ node.ssh.username = box["ssh"]["username"] if box["ssh"]["username"]
44
+ node.ssh.password = box["ssh"]["password"] if box["ssh"]["password"]
45
+ node.ssh.host = box["ssh"]["host"] if box["ssh"]["host"]
46
+ node.ssh.port = box["ssh"]["port"] if box["ssh"]["port"]
47
+ node.ssh.guest_port = box["ssh"]["guest_port"] if box["ssh"]["guest_port"]
48
+ node.ssh.private_key_path = box["ssh"]["private_key_path"] if box["ssh"]["private_key_path"]
49
+ node.ssh.forward_agent = box["ssh"]["forward_agent"] if box["ssh"]["forward_agent"]
50
+ node.ssh.forward_x11 = box["ssh"]["forward_x11"] if box["ssh"]["forward_x11"]
51
+ node.ssh.insert_key = box["ssh"]["insert_key"] if box["ssh"]["insert_key"]
52
+ node.ssh.proxy_command = box["ssh"]["proxy_command"] if box["ssh"]["proxy_command"]
53
+ node.ssh.pty = box["ssh"]["pty"] if box["ssh"]["pty"]
54
+ node.ssh.shell = box["ssh"]["shell"] if box["ssh"]["shell"]
55
+ end
56
+
57
+ if box["provision"]
58
+ box["provision"].each do |script|
59
+ node.vm.provision "shell" do |s|
60
+ s.inline = script["inline"] if script["inline"]
61
+ s.path = script["path"] if script["path"]
62
+ s.args = script["args"] if script["args"]
63
+ s.privileged = script["privileged"] if script["privileged"]
64
+ s.binary = script["binary"] if script["binary"]
65
+ s.upload_path = script["upload_path"] if script["upload_path"]
66
+ s.keep_color = script["keep_color"] if script["keep_color"]
67
+ s.powershell_args = script["powershell_args"] if script["powershell_args"]
68
+ end
69
+ end
70
+ end
71
+
72
+ node.vm.provider :virtualbox do |virtualbox, override|
73
+ virtualbox.gui = true if box["gui"]
74
+ virtualbox.cpus = box["cpus"] if box["cpus"]
75
+ virtualbox.memory = box["memory"] if box["memory"]
76
+ end
77
+
78
+ node.vm.provider :vmware_fusion do |vmware, override|
79
+ override.vm.node_url = "http://files.vagrantup.com/precise64_vmware.node"
80
+ vmware.gui = true if box["gui"]
81
+ vmware.vmx["numvcpus"] = box["cpus"] if box["cpus"]
82
+ vmware.vmx["memsize"] = box["cpus"] if box["memory"]
83
+ end
84
+
85
+ node.vm.provider :aws do |aws, override|
86
+ if box["aws"]
87
+ override.vm.box_url = "https://github.com/mitchellh/vagrant-aws/raw/master/dummy.box"
88
+
89
+ # Required parameters
90
+ aws.ami = box["aws"]["ami"] || 'ami-d05e75b8'
91
+ aws.instance_type = box["aws"]["instance_type"] || 't2.micro'
92
+ aws.keypair_name = box["aws"]["keypair_name"] || raise("An error occurred. Missing aws 'keypair name'.")
93
+ override.ssh.username = box["aws"]["username"] || 'ubuntu'
94
+ override.ssh.private_key_path = box["aws"]["private_key_path"]
95
+
96
+ # Alternative approach: add keys into your .bashrc or .zshrc profile
97
+ # export AWS_SECRET_KEY=secret_key
98
+ # export AWS_ACCESS_KEY=secret_key
99
+ aws.access_key_id = box["aws"]["access_key_id"] || ENV["AWS_ACCESS_KEY"]
100
+ aws.secret_access_key = box["aws"]["secret_access_key"] || ENV["AWS_SECRET_KEY"]
101
+ aws.session_token = box["aws"]["session_token"] || ENV["AWS_SESSION_TOKEN"]
102
+
103
+ # optional settings
104
+ aws.region = box["aws"]["region"] if box["aws"]["region"]
105
+ aws.availability_zone = box["aws"]["availability_zone"] if box["aws"]["availability_zone"]
106
+ aws.security_groups = box["aws"]["security_groups"] if box["aws"]["security_groups"]
107
+ aws.tags = box["aws"]["tags"] if box["aws"]["tags"]
108
+ aws.subnet_id = box["aws"]["subnet_id"] if box["aws"]["subnet_id"]
109
+ aws.availability_zone = box["aws"]["availability_zone"] if box["aws"]["availability_zone"]
110
+ aws.elastic_ip = box["aws"]["elastic_ip"] if box["aws"]["elastic_ip"]
111
+ aws.use_iam_profile = box["aws"]["use_iam_profile"] if box["aws"]["use_iam_profile"]
112
+ aws.private_ip_address = box["aws"]["private_ip_address"] if box["aws"]["private_ip_address"]
113
+ aws.user_data = box["aws"]["user_data"] if box["aws"]["user_data"]
114
+ aws.iam_instance_profile_name = box["aws"]["iam_instance_profile_name"] if box["aws"]["iam_instance_profile_name"]
115
+ aws.iam_instance_profile_arn = box["aws"]["iam_instance_profile_arn"] if box["aws"]["iam_instance_profile_arn"]
116
+ aws.instance_package_timeout = box["aws"]["instance_package_timeout"] if box["aws"]["instance_package_timeout"]
117
+ aws.instance_ready_timeout = box["aws"]["instance_ready_timeout"] if box["aws"]["instance_ready_timeout"]
118
+ end
119
+ end
120
+
121
+ node.vm.provider :digital_ocean do |digital_ocean, override|
122
+ if box["digital_ocean"]
123
+ override.vm.box_url = "https://github.com/smdahlen/vagrant-digitalocean/raw/master/box/digital_ocean.box"
124
+
125
+ digital_ocean.token = box["digital_ocean"].include?("token") ? box["digital_ocean"]["token"] : ENV["DIGITAL_OCEAN_TOKEN"]
126
+
127
+ # Optional
128
+ override.ssh.private_key_path = box["digital_ocean"]["private_key_path"]
129
+ override.ssh.username = box["digital_ocean"]["username"] if box["digital_ocean"]["username"]
130
+ digital_ocean.ssh_key_name = box["digital_ocean"].include?("ssh_key_name") ? box["digital_ocean"]["ssh_key_name"] : 'Vagrant'
131
+ digital_ocean.image = box["digital_ocean"].include?("image") ? box["digital_ocean"]["image"] : "ubuntu-14-04-x64"
132
+ digital_ocean.region = box["digital_ocean"].include?("region") ? box["digital_ocean"]["region"] : "nyc2"
133
+ digital_ocean.size = box["digital_ocean"].include?("size") ? box["digital_ocean"]["size"] : "512mb"
134
+ digital_ocean.ipv6 = box["digital_ocean"].include?("ipv6") ? box["digital_ocean"]["ipv6"] : false
135
+ digital_ocean.private_networking = box["digital_ocean"].include?("private_networking") ? box["digital_ocean"]["private_networking"] : false
136
+ digital_ocean.backups_enabled = box["digital_ocean"].include?("backups_enabled") ? box["digital_ocean"]["backups_enabled"] : false
137
+ digital_ocean.setup = box["digital_ocean"].include?("setup") ? box["digital_ocean"]["setup"] : true
138
+ end
139
+ end
140
+ end
141
+ end
142
+ end
143
+
144
+ def get_nodes(v=nil)
145
+ boxes = {}
146
+
147
+ v["boxes"].collect do |box|
148
+ next unless box["hostname"]
149
+
150
+ boxes[box["hostname"]] = {}
151
+
152
+ boxes[box["hostname"]]["box"] = v["box"] if v["box"]
153
+ boxes[box["hostname"]]["box"] = box["box"] if box["box"]
154
+ boxes[box["hostname"]]["box_check_update"] = box["box_check_update"] if box["box_check_update"]
155
+ boxes[box["hostname"]]["box_url"] = box["box_url"]
156
+ boxes[box["hostname"]]["box_check_update"] = box["box_check_update"]
157
+ boxes[box["hostname"]]["boot_timeout"] = box["boot_timeout"]
158
+ boxes[box["hostname"]]["box_download_checksum"] = box["box_download_checksum"]
159
+ boxes[box["hostname"]]["box_download_checksum_type"] = box["box_download_checksum_type"]
160
+ boxes[box["hostname"]]["box_download_client_cert"] = box["box_download_client_cert"]
161
+ boxes[box["hostname"]]["box_download_ca_cert"] = box["box_download_ca_cert"]
162
+ boxes[box["hostname"]]["box_download_ca_path"] = box["box_download_ca_path"]
163
+ boxes[box["hostname"]]["box_download_insecure"] = box["box_download_insecure"]
164
+ boxes[box["hostname"]]["box_version"] = box["box_version"]
165
+ boxes[box["hostname"]]["communicator"] = box["communicator"]
166
+ boxes[box["hostname"]]["graceful_halt_timeout"] = box["graceful_halt_timeout"]
167
+ boxes[box["hostname"]]["guest"] = box["guest"]
168
+ boxes[box["hostname"]]["post_up_message"] = box["post_up_message"]
169
+ boxes[box["hostname"]]["usable_port_range"] = box["usable_port_range"]
170
+
171
+ boxes[box["hostname"]]["ip"] = box["ip"] if box["ip"]
172
+
173
+ if box["provision"]
174
+ boxes[box["hostname"]]["provision"] ||= []
175
+ box["provision"].each do |shell|
176
+ boxes[box["hostname"]]["provision"].push(shell)
177
+ end
178
+ end
179
+
180
+ if box["forwarded_ports"]
181
+ boxes[box["hostname"]]["forwarded_ports"] ||= []
182
+ box["forwarded_ports"].each do |item|
183
+ next unless ( item.include?('host') or item.include?('guest') )
184
+ boxes[box["hostname"]]["forwarded_ports"].push(item)
185
+ end
186
+ end
187
+
188
+ box["synced_folders"] = box["shared_folders"] if box["shared_folders"]
189
+
190
+ if box["synced_folders"]
191
+ boxes[box["hostname"]]["synced_folders"] ||= []
192
+ box["synced_folders"].each do |item|
193
+ next unless ( item.include?('host') or item.include?('guest') )
194
+ folder_args = item.dup
195
+ folder_args.delete('host')
196
+ folder_args.delete('guest')
197
+ folder_args = Hash[folder_args.map{ |key, value| [key.to_sym, value] }]
198
+
199
+ boxes[box["hostname"]]["synced_folders"].push({host: "#{item["host"]}", guest: "#{item["guest"]}", args: folder_args})
200
+ end
201
+ end
202
+
203
+ if box["ssh"]
204
+ boxes[box["hostname"]]["ssh"] ||= {}
205
+ box["ssh"].each do |key, value|
206
+ boxes[box["hostname"]]["ssh"][key] = value
207
+ end
208
+ end
209
+
210
+ if box["disable_default_synced_folder"]
211
+ boxes[box["hostname"]]["synced_folders"] ||= []
212
+ boxes[box["hostname"]]["synced_folders"].push({ host:".", guest: "/vagrant", args: {id: "vagrant-root", disabled: true}})
213
+ end
214
+
215
+ box["memory"] = box["ram"] if box["ram"]
216
+ boxes[box["hostname"]]["memory"] = box["memory"] if box["memory"]
217
+
218
+ box["cpus"] = box["cpu"] if box["cpu"]
219
+ boxes[box["hostname"]]["cpus"] = box["cpus"] if box["cpus"]
220
+
221
+ boxes[box["hostname"]]["gui"] = box["gui"] if box["gui"]
222
+ boxes[box["hostname"]]["disable_vm_optimization"] = box["disable_vm_optimization"] if box.include? "disable_vm_optimization"
223
+
224
+ boxes[box["hostname"]]["aws"] ||= []
225
+ boxes[box["hostname"]]["aws"] = box["aws"] if box["aws"]
226
+ boxes[box["hostname"]]["digital_ocean"] ||= []
227
+ boxes[box["hostname"]]["digital_ocean"] = box["digital_ocean"] if box["digital_ocean"]
228
+ end
229
+
230
+ boxes
231
+ end
@@ -0,0 +1,5 @@
1
+ module VagrantPlugins
2
+ module YarrsAndYamls
3
+ VERSION = '0.6.0'
4
+ end
5
+ end
@@ -0,0 +1 @@
1
+ require 'vagrant-yarrs-and-yamls/plugin'
@@ -0,0 +1,21 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'vagrant-yarrs-and-yamls/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "vagrant-yarrs-and-yamls"
8
+ spec.version = VagrantPlugins::YarrsAndYamls::VERSION
9
+ spec.authors = ["Pirate Dunbar"]
10
+ spec.email = ["yarr@piratedunbar.com"]
11
+ spec.description = "Configure your Vagrantfile using YAML"
12
+ spec.summary = spec.description
13
+ spec.homepage = "https://github.com/ptahdunbar/yamls-and-yarrs"
14
+ spec.license = "GPL v2+"
15
+ #spec.post_install_message = ""
16
+
17
+ spec.files = `git ls-files`.split($/)
18
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
19
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
20
+ spec.require_paths = ["lib"]
21
+ end
metadata ADDED
@@ -0,0 +1,57 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: vagrant-yarrs-and-yamls
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.6.0
5
+ platform: ruby
6
+ authors:
7
+ - Pirate Dunbar
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-07-06 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Configure your Vagrantfile using YAML
14
+ email:
15
+ - yarr@piratedunbar.com
16
+ executables: []
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - .gitignore
21
+ - Gemfile
22
+ - LICENSE.txt
23
+ - README.md
24
+ - Rakefile
25
+ - Vagrantfile
26
+ - example.Vagrantfile
27
+ - example.Vagrantfile.yml
28
+ - lib/vagrant-yarrs-and-yamls.rb
29
+ - lib/vagrant-yarrs-and-yamls/plugin.rb
30
+ - lib/vagrant-yarrs-and-yamls/v1.rb
31
+ - lib/vagrant-yarrs-and-yamls/version.rb
32
+ - vagrant-yarrs-and-yamls.gemspec
33
+ homepage: https://github.com/ptahdunbar/yamls-and-yarrs
34
+ licenses:
35
+ - GPL v2+
36
+ metadata: {}
37
+ post_install_message:
38
+ rdoc_options: []
39
+ require_paths:
40
+ - lib
41
+ required_ruby_version: !ruby/object:Gem::Requirement
42
+ requirements:
43
+ - - '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ required_rubygems_version: !ruby/object:Gem::Requirement
47
+ requirements:
48
+ - - '>='
49
+ - !ruby/object:Gem::Version
50
+ version: '0'
51
+ requirements: []
52
+ rubyforge_project:
53
+ rubygems_version: 2.1.11
54
+ signing_key:
55
+ specification_version: 4
56
+ summary: Configure your Vagrantfile using YAML
57
+ test_files: []