krates-plugin-vagrant 0.3.1

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.
Files changed (36) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +9 -0
  3. data/.gitmodules +3 -0
  4. data/.rspec +2 -0
  5. data/CHANGELOG.md +22 -0
  6. data/Gemfile +8 -0
  7. data/LICENSE.txt +214 -0
  8. data/README.md +77 -0
  9. data/krates-plugin-vagrant.gemspec +26 -0
  10. data/lib/kontena/machine/vagrant.rb +12 -0
  11. data/lib/kontena/machine/vagrant/Vagrantfile.master.rb.erb +113 -0
  12. data/lib/kontena/machine/vagrant/Vagrantfile.node.rb.erb +38 -0
  13. data/lib/kontena/machine/vagrant/cloudinit.yml +92 -0
  14. data/lib/kontena/machine/vagrant/common.rb +21 -0
  15. data/lib/kontena/machine/vagrant/master_destroyer.rb +21 -0
  16. data/lib/kontena/machine/vagrant/master_provisioner.rb +96 -0
  17. data/lib/kontena/machine/vagrant/node_destroyer.rb +35 -0
  18. data/lib/kontena/machine/vagrant/node_provisioner.rb +82 -0
  19. data/lib/kontena/plugin/vagrant.rb +7 -0
  20. data/lib/kontena/plugin/vagrant/master/create_command.rb +44 -0
  21. data/lib/kontena/plugin/vagrant/master/restart_command.rb +17 -0
  22. data/lib/kontena/plugin/vagrant/master/ssh_command.rb +24 -0
  23. data/lib/kontena/plugin/vagrant/master/start_command.rb +16 -0
  24. data/lib/kontena/plugin/vagrant/master/stop_command.rb +16 -0
  25. data/lib/kontena/plugin/vagrant/master/terminate_command.rb +13 -0
  26. data/lib/kontena/plugin/vagrant/master_command.rb +19 -0
  27. data/lib/kontena/plugin/vagrant/node_command.rb +19 -0
  28. data/lib/kontena/plugin/vagrant/nodes/create_command.rb +81 -0
  29. data/lib/kontena/plugin/vagrant/nodes/restart_command.rb +22 -0
  30. data/lib/kontena/plugin/vagrant/nodes/ssh_command.rb +28 -0
  31. data/lib/kontena/plugin/vagrant/nodes/start_command.rb +22 -0
  32. data/lib/kontena/plugin/vagrant/nodes/stop_command.rb +22 -0
  33. data/lib/kontena/plugin/vagrant/nodes/terminate_command.rb +26 -0
  34. data/lib/kontena/plugin/vagrant_command.rb +11 -0
  35. data/lib/kontena_cli_plugin.rb +5 -0
  36. metadata +119 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 91fd6b159536f33e826392682b2dedc51946364bb0d8a6d318bdf53c6124cb83
4
+ data.tar.gz: 0edb18a6743f26a77f788ab7a62c3935c0dac4caa7e23c17cedf81d6f91856e8
5
+ SHA512:
6
+ metadata.gz: d2dd9d0c130d5ea472beff39fec2f6c9207bf3900f9f3639348a62a32671932a83d301640cfa748cf920d50b2f77ced9dae0d180b8e97effef40c3321d854623
7
+ data.tar.gz: 9a732308293271b0b7e316296a306d5a511f3989331061c94e6aab23b4afb6d5f7b3acf75ab3ed966281e9c3ae80d803f62c017be75618a6227b727c5fa4371f
data/.gitignore ADDED
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
data/.gitmodules ADDED
@@ -0,0 +1,3 @@
1
+ [submodule "kontena"]
2
+ path = kontena
3
+ url = https://github.com/kontena/kontena.git
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --require spec_helper
data/CHANGELOG.md ADDED
@@ -0,0 +1,22 @@
1
+ # Changelog
2
+
3
+ ## 0.3.0 (2017-07-13)
4
+
5
+ - allow node IPs to be specified (#42)
6
+ - fix & improve cloudinits (#45, #40)
7
+ - remove vagrant from gemfile (#44)
8
+ - improve error handling and output (#41, #7, #25)
9
+
10
+ ## 0.2.7 (2017-05-03)
11
+
12
+ - fix vagrant master create --name (#37)
13
+ - sync travis.yml ruby versions with CLI and only deploy on 2.4.1 (#39)
14
+
15
+ ## 0.1.2 (2016-08-31)
16
+
17
+ - add provider labeling for nodes (#4)
18
+ - add ExecStop to systemd units (#2)
19
+
20
+ ## 0.1.1 (2016-08-10)
21
+
22
+ - first release as a plugin
data/Gemfile ADDED
@@ -0,0 +1,8 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in kontena-plugin-vagrant.gemspec
4
+ gemspec
5
+
6
+ group :development do
7
+ gem "rspec"
8
+ end
data/LICENSE.txt ADDED
@@ -0,0 +1,214 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2019 Pavel Tsurbeleu
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
23
+
24
+
25
+ Apache License
26
+ Version 2.0, January 2004
27
+ http://www.apache.org/licenses/
28
+
29
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
30
+
31
+ 1. Definitions.
32
+
33
+ "License" shall mean the terms and conditions for use, reproduction,
34
+ and distribution as defined by Sections 1 through 9 of this document.
35
+
36
+ "Licensor" shall mean the copyright owner or entity authorized by
37
+ the copyright owner that is granting the License.
38
+
39
+ "Legal Entity" shall mean the union of the acting entity and all
40
+ other entities that control, are controlled by, or are under common
41
+ control with that entity. For the purposes of this definition,
42
+ "control" means (i) the power, direct or indirect, to cause the
43
+ direction or management of such entity, whether by contract or
44
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
45
+ outstanding shares, or (iii) beneficial ownership of such entity.
46
+
47
+ "You" (or "Your") shall mean an individual or Legal Entity
48
+ exercising permissions granted by this License.
49
+
50
+ "Source" form shall mean the preferred form for making modifications,
51
+ including but not limited to software source code, documentation
52
+ source, and configuration files.
53
+
54
+ "Object" form shall mean any form resulting from mechanical
55
+ transformation or translation of a Source form, including but
56
+ not limited to compiled object code, generated documentation,
57
+ and conversions to other media types.
58
+
59
+ "Work" shall mean the work of authorship, whether in Source or
60
+ Object form, made available under the License, as indicated by a
61
+ copyright notice that is included in or attached to the work
62
+ (an example is provided in the Appendix below).
63
+
64
+ "Derivative Works" shall mean any work, whether in Source or Object
65
+ form, that is based on (or derived from) the Work and for which the
66
+ editorial revisions, annotations, elaborations, or other modifications
67
+ represent, as a whole, an original work of authorship. For the purposes
68
+ of this License, Derivative Works shall not include works that remain
69
+ separable from, or merely link (or bind by name) to the interfaces of,
70
+ the Work and Derivative Works thereof.
71
+
72
+ "Contribution" shall mean any work of authorship, including
73
+ the original version of the Work and any modifications or additions
74
+ to that Work or Derivative Works thereof, that is intentionally
75
+ submitted to Licensor for inclusion in the Work by the copyright owner
76
+ or by an individual or Legal Entity authorized to submit on behalf of
77
+ the copyright owner. For the purposes of this definition, "submitted"
78
+ means any form of electronic, verbal, or written communication sent
79
+ to the Licensor or its representatives, including but not limited to
80
+ communication on electronic mailing lists, source code control systems,
81
+ and issue tracking systems that are managed by, or on behalf of, the
82
+ Licensor for the purpose of discussing and improving the Work, but
83
+ excluding communication that is conspicuously marked or otherwise
84
+ designated in writing by the copyright owner as "Not a Contribution."
85
+
86
+ "Contributor" shall mean Licensor and any individual or Legal Entity
87
+ on behalf of whom a Contribution has been received by Licensor and
88
+ subsequently incorporated within the Work.
89
+
90
+ 2. Grant of Copyright License. Subject to the terms and conditions of
91
+ this License, each Contributor hereby grants to You a perpetual,
92
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
93
+ copyright license to reproduce, prepare Derivative Works of,
94
+ publicly display, publicly perform, sublicense, and distribute the
95
+ Work and such Derivative Works in Source or Object form.
96
+
97
+ 3. Grant of Patent License. Subject to the terms and conditions of
98
+ this License, each Contributor hereby grants to You a perpetual,
99
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
100
+ (except as stated in this section) patent license to make, have made,
101
+ use, offer to sell, sell, import, and otherwise transfer the Work,
102
+ where such license applies only to those patent claims licensable
103
+ by such Contributor that are necessarily infringed by their
104
+ Contribution(s) alone or by combination of their Contribution(s)
105
+ with the Work to which such Contribution(s) was submitted. If You
106
+ institute patent litigation against any entity (including a
107
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
108
+ or a Contribution incorporated within the Work constitutes direct
109
+ or contributory patent infringement, then any patent licenses
110
+ granted to You under this License for that Work shall terminate
111
+ as of the date such litigation is filed.
112
+
113
+ 4. Redistribution. You may reproduce and distribute copies of the
114
+ Work or Derivative Works thereof in any medium, with or without
115
+ modifications, and in Source or Object form, provided that You
116
+ meet the following conditions:
117
+
118
+ (a) You must give any other recipients of the Work or
119
+ Derivative Works a copy of this License; and
120
+
121
+ (b) You must cause any modified files to carry prominent notices
122
+ stating that You changed the files; and
123
+
124
+ (c) You must retain, in the Source form of any Derivative Works
125
+ that You distribute, all copyright, patent, trademark, and
126
+ attribution notices from the Source form of the Work,
127
+ excluding those notices that do not pertain to any part of
128
+ the Derivative Works; and
129
+
130
+ (d) If the Work includes a "NOTICE" text file as part of its
131
+ distribution, then any Derivative Works that You distribute must
132
+ include a readable copy of the attribution notices contained
133
+ within such NOTICE file, excluding those notices that do not
134
+ pertain to any part of the Derivative Works, in at least one
135
+ of the following places: within a NOTICE text file distributed
136
+ as part of the Derivative Works; within the Source form or
137
+ documentation, if provided along with the Derivative Works; or,
138
+ within a display generated by the Derivative Works, if and
139
+ wherever such third-party notices normally appear. The contents
140
+ of the NOTICE file are for informational purposes only and
141
+ do not modify the License. You may add Your own attribution
142
+ notices within Derivative Works that You distribute, alongside
143
+ or as an addendum to the NOTICE text from the Work, provided
144
+ that such additional attribution notices cannot be construed
145
+ as modifying the License.
146
+
147
+ You may add Your own copyright statement to Your modifications and
148
+ may provide additional or different license terms and conditions
149
+ for use, reproduction, or distribution of Your modifications, or
150
+ for any such Derivative Works as a whole, provided Your use,
151
+ reproduction, and distribution of the Work otherwise complies with
152
+ the conditions stated in this License.
153
+
154
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
155
+ any Contribution intentionally submitted for inclusion in the Work
156
+ by You to the Licensor shall be under the terms and conditions of
157
+ this License, without any additional terms or conditions.
158
+ Notwithstanding the above, nothing herein shall supersede or modify
159
+ the terms of any separate license agreement you may have executed
160
+ with Licensor regarding such Contributions.
161
+
162
+ 6. Trademarks. This License does not grant permission to use the trade
163
+ names, trademarks, service marks, or product names of the Licensor,
164
+ except as required for reasonable and customary use in describing the
165
+ origin of the Work and reproducing the content of the NOTICE file.
166
+
167
+ 7. Disclaimer of Warranty. Unless required by applicable law or
168
+ agreed to in writing, Licensor provides the Work (and each
169
+ Contributor provides its Contributions) on an "AS IS" BASIS,
170
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
171
+ implied, including, without limitation, any warranties or conditions
172
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
173
+ PARTICULAR PURPOSE. You are solely responsible for determining the
174
+ appropriateness of using or redistributing the Work and assume any
175
+ risks associated with Your exercise of permissions under this License.
176
+
177
+ 8. Limitation of Liability. In no event and under no legal theory,
178
+ whether in tort (including negligence), contract, or otherwise,
179
+ unless required by applicable law (such as deliberate and grossly
180
+ negligent acts) or agreed to in writing, shall any Contributor be
181
+ liable to You for damages, including any direct, indirect, special,
182
+ incidental, or consequential damages of any character arising as a
183
+ result of this License or out of the use or inability to use the
184
+ Work (including but not limited to damages for loss of goodwill,
185
+ work stoppage, computer failure or malfunction, or any and all
186
+ other commercial damages or losses), even if such Contributor
187
+ has been advised of the possibility of such damages.
188
+
189
+ 9. Accepting Warranty or Additional Liability. While redistributing
190
+ the Work or Derivative Works thereof, You may choose to offer,
191
+ and charge a fee for, acceptance of support, warranty, indemnity,
192
+ or other liability obligations and/or rights consistent with this
193
+ License. However, in accepting such obligations, You may act only
194
+ on Your own behalf and on Your sole responsibility, not on behalf
195
+ of any other Contributor, and only if You agree to indemnify,
196
+ defend, and hold each Contributor harmless for any liability
197
+ incurred by, or claims asserted against, such Contributor by reason
198
+ of your accepting any such warranty or additional liability.
199
+
200
+ END OF TERMS AND CONDITIONS
201
+
202
+ Copyright 2015 Kontena, Inc.
203
+
204
+ Licensed under the Apache License, Version 2.0 (the "License");
205
+ you may not use this file except in compliance with the License.
206
+ You may obtain a copy of the License at
207
+
208
+ http://www.apache.org/licenses/LICENSE-2.0
209
+
210
+ Unless required by applicable law or agreed to in writing, software
211
+ distributed under the License is distributed on an "AS IS" BASIS,
212
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
213
+ See the License for the specific language governing permissions and
214
+ limitations under the License.
data/README.md ADDED
@@ -0,0 +1,77 @@
1
+ # Krates Vagrant Plugin
2
+
3
+ This plugin provides support for Vagrant provisioning to Krates. Easiest way to test full Krates Platform setup locally.
4
+
5
+ ## System Requirements
6
+
7
+ - [Krates](https://krates.io/)
8
+ - [Vagrant](https://www.vagrantup.com/)
9
+ - [VirtualBox](https://www.virtualbox.org/)
10
+
11
+ ## Installation
12
+
13
+ ```
14
+ $ krates plugin install vagrant
15
+ ```
16
+
17
+ ## Commands
18
+
19
+ #### Vagrant Master
20
+
21
+ ```
22
+ $ krates vagrant master
23
+ Usage:
24
+ krates vagrant master [OPTIONS] SUBCOMMAND [ARG] ...
25
+
26
+ Parameters:
27
+ SUBCOMMAND subcommand
28
+ [ARG] ... subcommand arguments
29
+
30
+ Subcommands:
31
+ create Create a new Vagrant master
32
+ ssh SSH into Vagrant master
33
+ start Start Vagrant master
34
+ stop Stop Vagrant master
35
+ restart Restart Vagrant master
36
+ terminate Terminate Vagrant master
37
+
38
+ Options:
39
+ -h, --help print help
40
+ ```
41
+
42
+ #### Vagrant Node
43
+
44
+ ```
45
+ $ krates vagrant node
46
+ Usage:
47
+ krates vagrant node [OPTIONS] SUBCOMMAND [ARG] ...
48
+
49
+ Parameters:
50
+ SUBCOMMAND subcommand
51
+ [ARG] ... subcommand arguments
52
+
53
+ Subcommands:
54
+ create Create a new node to Vagrant
55
+ ssh Ssh into Vagrant node
56
+ start Start Vagrant node
57
+ stop Stop Vagrant node
58
+ restart Restart Vagrant node
59
+ terminate Terminate Vagrant node
60
+
61
+ Options:
62
+ -h, --help print help
63
+ ```
64
+
65
+ ## Contributing
66
+
67
+ 1. Fork it ( https://staticpagesio@bitbucket.org/staticpagesio/krates-plugin-vagrant.git )
68
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
69
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
70
+ 4. Push to the branch (`git push origin my-new-feature`)
71
+ 5. Create a new Pull Request
72
+
73
+ ## License
74
+
75
+ Krates is licensed under the MIT License. See [LICENSE](LICENSE.txt) for full license text.
76
+
77
+ Kontena is licensed under the Apache License, Version 2.0. See [LICENSE](LICENSE.txt) for full license text.
@@ -0,0 +1,26 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'kontena/plugin/vagrant'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "krates-plugin-vagrant"
8
+ spec.version = Kontena::Plugin::Vagrant::VERSION
9
+ spec.authors = ["Pavel Tsurbeleu"]
10
+ spec.email = ["info@kontena.io"]
11
+
12
+ spec.summary = "Krates Vagrant plugin"
13
+ spec.description = "Krates Vagrant plugin"
14
+ spec.homepage = "https://krates.appsters.io"
15
+ spec.license = "MIT"
16
+
17
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
18
+ spec.require_paths = ["lib"]
19
+
20
+ # NOTE: Exclude files not relevant to the plugin
21
+ spec.files -= %w[ Dockerfile Makefile docker-compose.yml docker-compose.d.yml docker-compose.r.yml Jenkinsfile .dockerignore ]
22
+
23
+ spec.add_runtime_dependency 'krates', '~> 1.6.0'
24
+ spec.add_development_dependency "bundler"
25
+ spec.add_development_dependency "rake", "~> 10.0"
26
+ end
@@ -0,0 +1,12 @@
1
+ require 'kontena/machine/common'
2
+ include Kontena::Machine::Common
3
+
4
+ unless which('vagrant')
5
+ abort('Vagrant is not installed. See https://www.vagrantup.com/ for instructions.')
6
+ end
7
+
8
+ require 'kontena/machine/random_name'
9
+ require_relative 'vagrant/master_provisioner'
10
+ require_relative 'vagrant/master_destroyer'
11
+ require_relative 'vagrant/node_provisioner'
12
+ require_relative 'vagrant/node_destroyer'
@@ -0,0 +1,113 @@
1
+ # -*- mode: ruby -*-
2
+ # vi: set ft=ruby :
3
+
4
+ # Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
5
+ VAGRANTFILE_API_VERSION = "2"
6
+
7
+ cloud_init = <<INIT
8
+ #cloud-config
9
+ write_files:
10
+ - path: /etc/kontena-server.env
11
+ permissions: 0600
12
+ owner: root
13
+ content: |
14
+ KONTENA_VERSION=<%= version %>
15
+ KONTENA_VAULT_KEY=<%= vault_secret %>
16
+ KONTENA_VAULT_IV=<%= vault_iv %>
17
+ coreos:
18
+ update:
19
+ reboot-strategy: off
20
+ units:
21
+ - name: kontena-server-mongo.service
22
+ command: start
23
+ enable: true
24
+ content: |
25
+ [Unit]
26
+ Description=kontena-server-mongo
27
+ After=network-online.target
28
+ After=docker.service
29
+ Description=Kontena Server MongoDB
30
+ Documentation=http://www.mongodb.org/
31
+ Requires=network-online.target
32
+ Requires=docker.service
33
+
34
+ [Service]
35
+ Restart=always
36
+ RestartSec=5
37
+ TimeoutStartSec=0
38
+ ExecStartPre=/usr/bin/docker pull mongo:3.2
39
+ ExecStartPre=-/usr/bin/docker network create kontena
40
+ ExecStartPre=-/usr/bin/docker volume create kontena-server-mongo
41
+ ExecStartPre=-/usr/bin/docker stop kontena-server-mongo
42
+ ExecStartPre=-/usr/bin/docker rm kontena-server-mongo
43
+ ExecStart=/usr/bin/docker run --name=kontena-server-mongo \
44
+ -v kontena-server-mongo:/data/db \
45
+ --network kontena \
46
+ mongo:3.2
47
+ ExecStop=/usr/bin/docker stop kontena-server-mongo
48
+
49
+ - name: kontena-server-api.service
50
+ command: start
51
+ enable: true
52
+ content: |
53
+ [Unit]
54
+ Description=kontena-server-api
55
+ After=network-online.target
56
+ After=docker.service
57
+ After=kontena-server-mongo.service
58
+ Description=Kontena Master
59
+ Documentation=http://www.kontena.io/
60
+ Requires=network-online.target
61
+ Requires=docker.service
62
+ Requires=kontena-server-mongo.service
63
+
64
+ [Service]
65
+ Restart=always
66
+ RestartSec=5
67
+ TimeoutStartSec=0
68
+ EnvironmentFile=/etc/kontena-server.env
69
+ ExecStartPre=-/usr/bin/docker stop kontena-server-api
70
+ ExecStartPre=-/usr/bin/docker rm kontena-server-api
71
+ ExecStartPre=-/usr/bin/docker network create kontena
72
+ ExecStartPre=/usr/bin/docker pull kontena/server:${KONTENA_VERSION}
73
+ ExecStart=/usr/bin/docker run --name kontena-server-api \
74
+ -e MONGODB_URI=mongodb://kontena-server-mongo:27017/kontena_server \
75
+ -e VAULT_KEY=${KONTENA_VAULT_KEY} -e VAULT_IV=${KONTENA_VAULT_IV} \
76
+ <% if server_name %>-e SERVER_NAME=<%= server_name %><% end %> \
77
+ <% if initial_admin_code %>-e INITIAL_ADMIN_CODE=<%= initial_admin_code %><% end %> \
78
+ --network kontena \
79
+ -p 8080:9292 \
80
+ kontena/server:${KONTENA_VERSION}
81
+ ExecStop=/usr/bin/docker stop kontena-server-api
82
+ INIT
83
+
84
+ cloud_init_file = Tempfile.new('kontena-master')
85
+ File.write(cloud_init_file.path, cloud_init)
86
+
87
+ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
88
+ config.vm.provider :virtualbox do |v|
89
+ v.check_guest_additions = false
90
+ v.functional_vboxsf = false
91
+ end
92
+
93
+ if Vagrant.has_plugin?("vagrant-vbguest") then
94
+ config.vbguest.auto_update = false
95
+ end
96
+
97
+ config.vm.define "<%= name %>" do |docker|
98
+ docker.vm.box = "coreos-<%= coreos_channel %>"
99
+ docker.vm.box_url = "http://stable.release.core-os.net/amd64-usr/current/coreos_production_vagrant.json"
100
+ docker.vm.network "private_network", ip: "192.168.66.100"
101
+ docker.vm.hostname = "<%= name %>"
102
+ docker.vm.provider "virtualbox" do |vb|
103
+ vb.name = "<%= name %>"
104
+ vb.gui = false
105
+ vb.memory = <%= memory %>
106
+ vb.auto_nat_dns_proxy = false
107
+ vb.customize ["modifyvm", :id, "--natdnsproxy1", "off" ]
108
+ vb.customize ["modifyvm", :id, "--natdnshostresolver1", "off" ]
109
+ end
110
+ docker.vm.provision :file, :source => cloud_init_file.path, :destination => "/tmp/vagrantfile-user-data"
111
+ docker.vm.provision :shell, :inline => "mv /tmp/vagrantfile-user-data /var/lib/coreos-vagrant/", :privileged => true
112
+ end
113
+ end