vagrant-skytap 0.1.1a
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +21 -0
- data/.hgignore +22 -0
- data/.project +11 -0
- data/.rspec +1 -0
- data/CHANGELOG.md +85 -0
- data/Gemfile +29 -0
- data/LICENSE +8 -0
- data/README.md +292 -0
- data/Rakefile +31 -0
- data/Vagrantfile.orig +34 -0
- data/bar/checksums.yaml +7 -0
- data/bar/data.tar +0 -0
- data/bar/metadata +242 -0
- data/dummy.box +0 -0
- data/example_box/README.md +13 -0
- data/example_box/metadata.json +3 -0
- data/lib/vagrant-skytap/action/add_vm_to_environment.rb +35 -0
- data/lib/vagrant-skytap/action/create_environment.rb +44 -0
- data/lib/vagrant-skytap/action/delete_environment.rb +26 -0
- data/lib/vagrant-skytap/action/delete_vm.rb +27 -0
- data/lib/vagrant-skytap/action/existence_check.rb +35 -0
- data/lib/vagrant-skytap/action/fetch_environment.rb +32 -0
- data/lib/vagrant-skytap/action/initialize_api_client.rb +28 -0
- data/lib/vagrant-skytap/action/is_running.rb +19 -0
- data/lib/vagrant-skytap/action/is_stopped.rb +19 -0
- data/lib/vagrant-skytap/action/is_suspended.rb +19 -0
- data/lib/vagrant-skytap/action/message_already_created.rb +16 -0
- data/lib/vagrant-skytap/action/message_already_running.rb +16 -0
- data/lib/vagrant-skytap/action/message_environment_url.rb +16 -0
- data/lib/vagrant-skytap/action/message_not_created.rb +16 -0
- data/lib/vagrant-skytap/action/message_will_not_destroy.rb +16 -0
- data/lib/vagrant-skytap/action/mixin_machine_index.rb +22 -0
- data/lib/vagrant-skytap/action/prepare_nfs_settings.rb +46 -0
- data/lib/vagrant-skytap/action/prepare_nfs_valid_ids.rb +28 -0
- data/lib/vagrant-skytap/action/read_ssh_info.rb +23 -0
- data/lib/vagrant-skytap/action/read_state.rb +42 -0
- data/lib/vagrant-skytap/action/run_environment.rb +53 -0
- data/lib/vagrant-skytap/action/run_vm.rb +51 -0
- data/lib/vagrant-skytap/action/set_hostname.rb +31 -0
- data/lib/vagrant-skytap/action/set_up_vm.rb +21 -0
- data/lib/vagrant-skytap/action/stop_environment.rb +43 -0
- data/lib/vagrant-skytap/action/stop_vm.rb +43 -0
- data/lib/vagrant-skytap/action/store_extra_data.rb +35 -0
- data/lib/vagrant-skytap/action/suspend_environment.rb +32 -0
- data/lib/vagrant-skytap/action/suspend_vm.rb +32 -0
- data/lib/vagrant-skytap/action/timed_provision.rb +21 -0
- data/lib/vagrant-skytap/action/update_hardware.rb +37 -0
- data/lib/vagrant-skytap/action.rb +272 -0
- data/lib/vagrant-skytap/api/busyable.rb +37 -0
- data/lib/vagrant-skytap/api/client.rb +127 -0
- data/lib/vagrant-skytap/api/credentials.rb +41 -0
- data/lib/vagrant-skytap/api/environment.rb +99 -0
- data/lib/vagrant-skytap/api/interface.rb +123 -0
- data/lib/vagrant-skytap/api/network.rb +40 -0
- data/lib/vagrant-skytap/api/public_ip.rb +103 -0
- data/lib/vagrant-skytap/api/published_service.rb +90 -0
- data/lib/vagrant-skytap/api/resource.rb +44 -0
- data/lib/vagrant-skytap/api/runstate_operations.rb +63 -0
- data/lib/vagrant-skytap/api/specified_attributes.rb +27 -0
- data/lib/vagrant-skytap/api/vm.rb +88 -0
- data/lib/vagrant-skytap/api/vpn.rb +146 -0
- data/lib/vagrant-skytap/api/vpn_attachment.rb +57 -0
- data/lib/vagrant-skytap/config.rb +106 -0
- data/lib/vagrant-skytap/core_ext/object/blank.rb +82 -0
- data/lib/vagrant-skytap/core_ext/object/tap.rb +8 -0
- data/lib/vagrant-skytap/core_ext/try.rb +42 -0
- data/lib/vagrant-skytap/environment_properties.rb +11 -0
- data/lib/vagrant-skytap/errors.rb +59 -0
- data/lib/vagrant-skytap/plugin.rb +73 -0
- data/lib/vagrant-skytap/properties.rb +42 -0
- data/lib/vagrant-skytap/provider.rb +50 -0
- data/lib/vagrant-skytap/setup_helper.rb +193 -0
- data/lib/vagrant-skytap/util/ip_address.rb +69 -0
- data/lib/vagrant-skytap/util/subnet.rb +97 -0
- data/lib/vagrant-skytap/util/timer.rb +17 -0
- data/lib/vagrant-skytap/version.rb +5 -0
- data/lib/vagrant-skytap/version.rb.orig +5 -0
- data/lib/vagrant-skytap/vm_properties.rb +22 -0
- data/lib/vagrant-skytap.rb +23 -0
- data/locales/en.yml +127 -0
- data/skytap-dummy.box +0 -0
- data/spec/acceptance/base.rb +2 -0
- data/spec/acceptance/provider/halt_spec.rb +3 -0
- data/spec/acceptance/shared/context_skytap.rb +3 -0
- data/spec/spec_helper.rb +1 -0
- data/spec/support/isolated_environment.rb +45 -0
- data/spec/unit/base.rb +57 -0
- data/spec/unit/config_spec.rb +73 -0
- data/spec/unit/environment_spec.rb +144 -0
- data/spec/unit/skeletons/empty_environment.json +19 -0
- data/spec/unit/skeletons/network1.json +36 -0
- data/spec/unit/skeletons/vm1.json +85 -0
- data/spec/unit/support/dummy_communicator.rb +83 -0
- data/spec/unit/support/dummy_provider.rb +41 -0
- data/spec/unit/support/isolated_environment.rb +217 -0
- data/spec/unit/support/shared/action_synced_folders_context.rb +15 -0
- data/spec/unit/support/shared/base_context.rb +116 -0
- data/spec/unit/support/shared/capability_helpers_context.rb +29 -0
- data/spec/unit/support/shared/plugin_command_context.rb +12 -0
- data/spec/unit/support/shared/skytap_context.rb +3 -0
- data/spec/unit/vm_spec.rb +118 -0
- data/tasks/acceptance.rake +22 -0
- data/tasks/bundler.rake +3 -0
- data/tasks/test.rake +14 -0
- data/vagrant-skytap.gemspec +62 -0
- data/vagrant-spec.config.rb +10 -0
- metadata +247 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 22140ddb6bfd113e35e4a233e04b5718b140f540
|
4
|
+
data.tar.gz: dc7340b51f642a1a40a12696c686d4b283e3613b
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: ef638666fdcc0cdc9893e473651e03560843baea4a7729263cacc63c5e6d77ac137247454fb8345ed34154f3731e2bf0d1b615b8fb9bf1a702e8134d319bd755
|
7
|
+
data.tar.gz: 41c0de3361f343d938a5aaa5b46d68f53a294cb02a752f9b9806dc5267fd4bbd016a39b8bf7800319e65534bcb3020800562ef37b9d59045a5af47f44f0aef3c
|
data/.gitignore
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
# OS-specific
|
2
|
+
.DS_Store
|
3
|
+
|
4
|
+
# editors
|
5
|
+
*.swp
|
6
|
+
|
7
|
+
# Bundler/Rubygems
|
8
|
+
*.gem
|
9
|
+
.bundle
|
10
|
+
pkg/*
|
11
|
+
tags
|
12
|
+
Gemfile.lock
|
13
|
+
|
14
|
+
# Vagrant
|
15
|
+
.vagrant
|
16
|
+
Vagrantfile
|
17
|
+
!example_box/Vagrantfile
|
18
|
+
|
19
|
+
# RVM files for gemset/ruby setting
|
20
|
+
.ruby-*
|
21
|
+
.rvmrc
|
data/.hgignore
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Syntax: regexp
|
2
|
+
|
3
|
+
# OS-specific
|
4
|
+
^\.DS_Store$
|
5
|
+
|
6
|
+
# editors
|
7
|
+
\.swp$
|
8
|
+
|
9
|
+
# Bundler/Rubygems
|
10
|
+
\.gem$
|
11
|
+
^\.bundle$
|
12
|
+
pkg/
|
13
|
+
^tags$
|
14
|
+
^Gemfile\.lock$
|
15
|
+
|
16
|
+
# Vagrant
|
17
|
+
^\.vagrant$
|
18
|
+
^Vagrantfile$
|
19
|
+
#!example_box/Vagrantfile
|
20
|
+
|
21
|
+
# RVM files for gemset/ruby setting
|
22
|
+
\.ruby-version$
|
data/.project
ADDED
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--format doc --order random --color --fail-fast
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,85 @@
|
|
1
|
+
# 0.5.0 (June 22, 2014)
|
2
|
+
|
3
|
+
* Support for associating public IPs for VMs inside of VPCs (GH
|
4
|
+
[#219](https://github.com/mitchellh/vagrant-aws/pull/219), GH
|
5
|
+
[#205](https://github.com/mitchellh/vagrant-aws/issues/205))
|
6
|
+
* Bug-fix for per region configs with `associate_public_ip` (GH
|
7
|
+
[#237](https://github.com/mitchellh/vagrant-aws/pull/237))
|
8
|
+
* rsyncing folders uses `--delete` flag to better emulate "real shared folders
|
9
|
+
(GH [#194](https://github.com/mitchellh/vagrant-aws/pull/194))
|
10
|
+
* fog gem version bumped to 1.22 (GH [#253](https://github.com/mitchellh/vagrant-aws/pull/253))
|
11
|
+
|
12
|
+
# 0.4.1 (December 17, 2013)
|
13
|
+
|
14
|
+
* Update fog.io to 1.18.0
|
15
|
+
* Fix sync folder user permissions (GH #175)
|
16
|
+
* Fix vagrant < 1.3.0 provisioner compatibility (GH #173)
|
17
|
+
* Add vagrant 1.4.0 multiple SSH key support (GH #172)
|
18
|
+
* Fix EIP deallocation bug (GH #164)
|
19
|
+
* Add (per shared folder) rsync exclude flag (GH #156)
|
20
|
+
|
21
|
+
# 0.4.0 (October 11, 2013)
|
22
|
+
|
23
|
+
* Handle EIP allocation error (GH #134)
|
24
|
+
* Implement halt and reload (GH #31)
|
25
|
+
* rsync ignores Vagrantfile
|
26
|
+
* warn if none of the security groups allows incoming SSH
|
27
|
+
* bump fog.io to 1.15.0
|
28
|
+
* Fix rsync on windows (GH #77)
|
29
|
+
* Add `ssh_host_attribute` config (GH #143)
|
30
|
+
|
31
|
+
# 0.3.0 (September 2, 2013)
|
32
|
+
|
33
|
+
* Parallelize multi-machine up on Vagrant 1.2+
|
34
|
+
* Show proper configuration errors if an invalid configuration key
|
35
|
+
is used.
|
36
|
+
* Request confirmation on `vagrant destroy`, like normal VirtualBox + Vagrant.
|
37
|
+
* If user data is configured, output is shown on "vagrant up" that
|
38
|
+
it is being set.
|
39
|
+
* Add EIP support (GH #65)
|
40
|
+
* Add block device mapping support (GH #93)
|
41
|
+
* README improvements (GH #120)
|
42
|
+
* Fix missing locale message (GH #73)
|
43
|
+
* SyncFolders creates hostpath if it doesn't exist and `:create` option is set (GH #17)
|
44
|
+
* Add IAM Instance Profile support (GH #68)
|
45
|
+
* Add shutdown behavior support (GH #125,#131)
|
46
|
+
|
47
|
+
# 0.2.2 (April 18, 2013)
|
48
|
+
|
49
|
+
* Fix crashing bug with incorrect provisioner arguments.
|
50
|
+
|
51
|
+
# 0.2.1 (April 16, 2013)
|
52
|
+
|
53
|
+
* Got rid of extranneous references to old SSH settings.
|
54
|
+
|
55
|
+
# 0.2.0 (April 16, 2013)
|
56
|
+
|
57
|
+
* Add support for `vagrant ssh -c` [GH-42]
|
58
|
+
* Ability to specify a timeout for waiting for instances to become ready. [GH-44]
|
59
|
+
* Better error message if instance didn't become ready in time.
|
60
|
+
* Connection can now be done using IAM profiles. [GH-41]
|
61
|
+
|
62
|
+
# 0.1.3 (April 9, 2013)
|
63
|
+
|
64
|
+
* The `AWS_ACCESS_KEY` and `AWS_SECRET_KEY` will be used if available
|
65
|
+
and no specific keys are set in the Vagrantfile. [GH-33]
|
66
|
+
* Fix issues with SSH on VPCs, the correct IP is used. [GH-30]
|
67
|
+
* Exclude the ".vagrant" directory from rsync.
|
68
|
+
* Implement `:disabled` flag support for shared folders. [GH-29]
|
69
|
+
* `aws.user_data` to specify user data on the instance. [GH-26]
|
70
|
+
|
71
|
+
# 0.1.2 (March 22, 2013)
|
72
|
+
|
73
|
+
* Choose the proper region when connecting to AWS. [GH-9]
|
74
|
+
* Configurable SSH port. [GH-13]
|
75
|
+
* Support other AWS-compatible API endpoints with `config.endpoint`
|
76
|
+
and `config.version`. [GH-6]
|
77
|
+
* Disable strict host key checking on rsync so known hosts aren't an issue. [GH-7]
|
78
|
+
|
79
|
+
# 0.1.1 (March 18, 2013)
|
80
|
+
|
81
|
+
* Up fog dependency for Vagrant 1.1.1
|
82
|
+
|
83
|
+
# 0.1.0 (March 14, 2013)
|
84
|
+
|
85
|
+
* Initial release.
|
data/Gemfile
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
source "https://rubygems.org"
|
2
|
+
|
3
|
+
gemspec
|
4
|
+
|
5
|
+
group :development do
|
6
|
+
# We depend on Vagrant for development, but we don't add it as a
|
7
|
+
# gem dependency because we expect to be installed within the
|
8
|
+
# Vagrant environment itself using `vagrant plugin`.
|
9
|
+
if File.exist?(File.expand_path("../../vagrant", __FILE__))
|
10
|
+
gem 'vagrant', path: "../vagrant"
|
11
|
+
else
|
12
|
+
# TODO test against tip
|
13
|
+
gem "vagrant", :git => "git://github.com/mitchellh/vagrant.git", :tag => 'v1.7.2'
|
14
|
+
end
|
15
|
+
gem "byebug"
|
16
|
+
|
17
|
+
|
18
|
+
if File.exist?(File.expand_path("../../vagrant-spec", __FILE__))
|
19
|
+
gem 'vagrant-spec', path: "../vagrant-spec"
|
20
|
+
else
|
21
|
+
gem 'vagrant-spec', git: "https://github.com/mitchellh/vagrant-spec.git"
|
22
|
+
end
|
23
|
+
|
24
|
+
gem "rspec-expectations", "~> 2.14.0"
|
25
|
+
end
|
26
|
+
|
27
|
+
group :plugins do
|
28
|
+
gem "vagrant-skytap", path: "."
|
29
|
+
end
|
data/LICENSE
ADDED
@@ -0,0 +1,8 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
Copyright (c) 2015 Skytap, Inc.
|
3
|
+
|
4
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
5
|
+
|
6
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
7
|
+
|
8
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,292 @@
|
|
1
|
+
# Vagrant AWS Provider
|
2
|
+
|
3
|
+
<span class="badges">
|
4
|
+
[![Gem Version](https://badge.fury.io/rb/vagrant-aws.png)][gem]
|
5
|
+
[![Dependency Status](https://gemnasium.com/mitchellh/vagrant-aws.png)][gemnasium]
|
6
|
+
</span>
|
7
|
+
|
8
|
+
[gem]: https://rubygems.org/gems/vagrant-aws
|
9
|
+
[gemnasium]: https://gemnasium.com/mitchellh/vagrant-aws
|
10
|
+
|
11
|
+
This is a [Vagrant](http://www.vagrantup.com) 1.2+ plugin that adds an [AWS](http://aws.amazon.com)
|
12
|
+
provider to Vagrant, allowing Vagrant to control and provision machines in
|
13
|
+
EC2 and VPC.
|
14
|
+
|
15
|
+
**NOTE:** This plugin requires Vagrant 1.2+,
|
16
|
+
|
17
|
+
## Features
|
18
|
+
|
19
|
+
* Boot EC2 or VPC instances.
|
20
|
+
* SSH into the instances.
|
21
|
+
* Provision the instances with any built-in Vagrant provisioner.
|
22
|
+
* Minimal synced folder support via `rsync`.
|
23
|
+
* Define region-specifc configurations so Vagrant can manage machines
|
24
|
+
in multiple regions.
|
25
|
+
|
26
|
+
## Usage
|
27
|
+
|
28
|
+
Install using standard Vagrant 1.1+ plugin installation methods. After
|
29
|
+
installing, `vagrant up` and specify the `aws` provider. An example is
|
30
|
+
shown below.
|
31
|
+
|
32
|
+
```
|
33
|
+
$ vagrant plugin install vagrant-aws
|
34
|
+
...
|
35
|
+
$ vagrant up --provider=aws
|
36
|
+
...
|
37
|
+
```
|
38
|
+
|
39
|
+
Of course prior to doing this, you'll need to obtain an AWS-compatible
|
40
|
+
box file for Vagrant.
|
41
|
+
|
42
|
+
## Quick Start
|
43
|
+
|
44
|
+
After installing the plugin (instructions above), the quickest way to get
|
45
|
+
started is to actually use a dummy AWS box and specify all the details
|
46
|
+
manually within a `config.vm.provider` block. So first, add the dummy
|
47
|
+
box using any name you want:
|
48
|
+
|
49
|
+
```
|
50
|
+
$ vagrant box add dummy https://github.com/mitchellh/vagrant-aws/raw/master/dummy.box
|
51
|
+
...
|
52
|
+
```
|
53
|
+
|
54
|
+
And then make a Vagrantfile that looks like the following, filling in
|
55
|
+
your information where necessary.
|
56
|
+
|
57
|
+
```
|
58
|
+
Vagrant.configure("2") do |config|
|
59
|
+
config.vm.box = "dummy"
|
60
|
+
|
61
|
+
config.vm.provider :aws do |aws, override|
|
62
|
+
aws.access_key_id = "YOUR KEY"
|
63
|
+
aws.secret_access_key = "YOUR SECRET KEY"
|
64
|
+
aws.keypair_name = "KEYPAIR NAME"
|
65
|
+
|
66
|
+
aws.ami = "ami-7747d01e"
|
67
|
+
|
68
|
+
override.ssh.username = "ubuntu"
|
69
|
+
override.ssh.private_key_path = "PATH TO YOUR PRIVATE KEY"
|
70
|
+
end
|
71
|
+
end
|
72
|
+
```
|
73
|
+
|
74
|
+
And then run `vagrant up --provider=aws`.
|
75
|
+
|
76
|
+
This will start an Ubuntu 12.04 instance in the us-east-1 region within
|
77
|
+
your account. And assuming your SSH information was filled in properly
|
78
|
+
within your Vagrantfile, SSH and provisioning will work as well.
|
79
|
+
|
80
|
+
Note that normally a lot of this boilerplate is encoded within the box
|
81
|
+
file, but the box file used for the quick start, the "dummy" box, has
|
82
|
+
no preconfigured defaults.
|
83
|
+
|
84
|
+
If you have issues with SSH connecting, make sure that the instances
|
85
|
+
are being launched with a security group that allows SSH access.
|
86
|
+
|
87
|
+
## Box Format
|
88
|
+
|
89
|
+
Every provider in Vagrant must introduce a custom box format. This
|
90
|
+
provider introduces `aws` boxes. You can view an example box in
|
91
|
+
the [example_box/ directory](https://github.com/mitchellh/vagrant-aws/tree/master/example_box).
|
92
|
+
That directory also contains instructions on how to build a box.
|
93
|
+
|
94
|
+
The box format is basically just the required `metadata.json` file
|
95
|
+
along with a `Vagrantfile` that does default settings for the
|
96
|
+
provider-specific configuration for this provider.
|
97
|
+
|
98
|
+
## Configuration
|
99
|
+
|
100
|
+
This provider exposes quite a few provider-specific configuration options:
|
101
|
+
|
102
|
+
* `access_key_id` - The access key for accessing AWS
|
103
|
+
* `ami` - The AMI id to boot, such as "ami-12345678"
|
104
|
+
* `availability_zone` - The availability zone within the region to launch
|
105
|
+
the instance. If nil, it will use the default set by Amazon.
|
106
|
+
* `instance_ready_timeout` - The number of seconds to wait for the instance
|
107
|
+
to become "ready" in AWS. Defaults to 120 seconds.
|
108
|
+
* `instance_type` - The type of instance, such as "m3.medium". The default
|
109
|
+
value of this if not specified is "m3.medium". "m1.small" has been
|
110
|
+
deprecated in "us-east-1" and "m3.medium" is the smallest instance
|
111
|
+
type to support both paravirtualization and hvm AMIs
|
112
|
+
* `keypair_name` - The name of the keypair to use to bootstrap AMIs
|
113
|
+
which support it.
|
114
|
+
* `private_ip_address` - The private IP address to assign to an instance
|
115
|
+
within a [VPC](http://aws.amazon.com/vpc/)
|
116
|
+
* `region` - The region to start the instance in, such as "us-east-1"
|
117
|
+
* `secret_access_key` - The secret access key for accessing AWS
|
118
|
+
* `security_groups` - An array of security groups for the instance. If this
|
119
|
+
instance will be launched in VPC, this must be a list of security group
|
120
|
+
Name.
|
121
|
+
* `iam_instance_profile_arn` - The Amazon resource name (ARN) of the IAM Instance
|
122
|
+
Profile to associate with the instance
|
123
|
+
* `iam_instance_profile_name` - The name of the IAM Instance Profile to associate
|
124
|
+
with the instance
|
125
|
+
* `subnet_id` - The subnet to boot the instance into, for VPC.
|
126
|
+
* `associate_public_ip` - If true, will associate a public IP address to an instance in a VPC.
|
127
|
+
* `tags` - A hash of tags to set on the machine.
|
128
|
+
* `use_iam_profile` - If true, will use [IAM profiles](http://docs.aws.amazon.com/IAM/latest/UserGuide/instance-profiles.html)
|
129
|
+
for credentials.
|
130
|
+
* `block_device_mapping` - Amazon EC2 Block Device Mapping Property
|
131
|
+
|
132
|
+
These can be set like typical provider-specific configuration:
|
133
|
+
|
134
|
+
```ruby
|
135
|
+
Vagrant.configure("2") do |config|
|
136
|
+
# ... other stuff
|
137
|
+
|
138
|
+
config.vm.provider :aws do |aws|
|
139
|
+
aws.access_key_id = "foo"
|
140
|
+
aws.secret_access_key = "bar"
|
141
|
+
end
|
142
|
+
end
|
143
|
+
```
|
144
|
+
|
145
|
+
In addition to the above top-level configs, you can use the `region_config`
|
146
|
+
method to specify region-specific overrides within your Vagrantfile. Note
|
147
|
+
that the top-level `region` config must always be specified to choose which
|
148
|
+
region you want to actually use, however. This looks like this:
|
149
|
+
|
150
|
+
```ruby
|
151
|
+
Vagrant.configure("2") do |config|
|
152
|
+
# ... other stuff
|
153
|
+
|
154
|
+
config.vm.provider :aws do |aws|
|
155
|
+
aws.access_key_id = "foo"
|
156
|
+
aws.secret_access_key = "bar"
|
157
|
+
aws.region = "us-east-1"
|
158
|
+
|
159
|
+
# Simple region config
|
160
|
+
aws.region_config "us-east-1", :ami => "ami-12345678"
|
161
|
+
|
162
|
+
# More comprehensive region config
|
163
|
+
aws.region_config "us-west-2" do |region|
|
164
|
+
region.ami = "ami-87654321"
|
165
|
+
region.keypair_name = "company-west"
|
166
|
+
end
|
167
|
+
end
|
168
|
+
end
|
169
|
+
```
|
170
|
+
|
171
|
+
The region-specific configurations will override the top-level
|
172
|
+
configurations when that region is used. They otherwise inherit
|
173
|
+
the top-level configurations, as you would probably expect.
|
174
|
+
|
175
|
+
## Networks
|
176
|
+
|
177
|
+
Networking features in the form of `config.vm.network` are not
|
178
|
+
supported with `vagrant-aws`, currently. If any of these are
|
179
|
+
specified, Vagrant will emit a warning, but will otherwise boot
|
180
|
+
the AWS machine.
|
181
|
+
|
182
|
+
## Synced Folders
|
183
|
+
|
184
|
+
There is minimal support for synced folders. Upon `vagrant up`,
|
185
|
+
`vagrant reload`, and `vagrant provision`, the AWS provider will use
|
186
|
+
`rsync` (if available) to uni-directionally sync the folder to
|
187
|
+
the remote machine over SSH.
|
188
|
+
|
189
|
+
This is good enough for all built-in Vagrant provisioners (shell,
|
190
|
+
chef, and puppet) to work!
|
191
|
+
|
192
|
+
To exclude files or directories from rsync, use the `rsync_excludes` option. For example, to exclude the "bar" and "foo" directories:
|
193
|
+
|
194
|
+
```ruby
|
195
|
+
Vagrant.configure("2") do |config|
|
196
|
+
# ... other stuff
|
197
|
+
|
198
|
+
config.vm.synced_folder ".", "/vagrant", type: "rsync", :rsync_excludes => ['bar/', 'foo/']
|
199
|
+
end
|
200
|
+
```
|
201
|
+
|
202
|
+
## Other Examples
|
203
|
+
|
204
|
+
### Tags
|
205
|
+
|
206
|
+
To use tags, simply define a hash of key/value for the tags you want to associate to your instance, like:
|
207
|
+
|
208
|
+
```ruby
|
209
|
+
Vagrant.configure("2") do |config|
|
210
|
+
# ... other stuff
|
211
|
+
|
212
|
+
config.vm.provider "aws" do |aws|
|
213
|
+
aws.tags = {
|
214
|
+
'Name' => 'Some Name',
|
215
|
+
'Some Key' => 'Some Value'
|
216
|
+
}
|
217
|
+
end
|
218
|
+
end
|
219
|
+
```
|
220
|
+
|
221
|
+
### User data
|
222
|
+
|
223
|
+
You can specify user data for the instance being booted.
|
224
|
+
|
225
|
+
```ruby
|
226
|
+
Vagrant.configure("2") do |config|
|
227
|
+
# ... other stuff
|
228
|
+
|
229
|
+
config.vm.provider "aws" do |aws|
|
230
|
+
# Option 1: a single string
|
231
|
+
aws.user_data = "#!/bin/bash\necho 'got user data' > /tmp/user_data.log\necho"
|
232
|
+
|
233
|
+
# Option 2: use a file
|
234
|
+
aws.user_data = File.read("user_data.txt")
|
235
|
+
end
|
236
|
+
end
|
237
|
+
```
|
238
|
+
|
239
|
+
### Disk size
|
240
|
+
|
241
|
+
Need more space on your instance disk? Increase the disk size.
|
242
|
+
|
243
|
+
```ruby
|
244
|
+
Vagrant.configure("2") do |config|
|
245
|
+
# ... other stuff
|
246
|
+
|
247
|
+
config.vm.provider "aws" do |aws|
|
248
|
+
aws.block_device_mapping = [{ 'DeviceName' => '/dev/sda1', 'Ebs.VolumeSize' => 50 }]
|
249
|
+
end
|
250
|
+
end
|
251
|
+
```
|
252
|
+
|
253
|
+
### Elastic Load Balancers
|
254
|
+
|
255
|
+
You can automatically attach an instance to an ELB during boot and detach on destroy.
|
256
|
+
|
257
|
+
```ruby
|
258
|
+
Vagrant.configure("2") do |config|
|
259
|
+
# ... other stuff
|
260
|
+
|
261
|
+
config.vm.provider "aws" do |aws|
|
262
|
+
aws.elb = "production-web"
|
263
|
+
end
|
264
|
+
end
|
265
|
+
```
|
266
|
+
|
267
|
+
## Development
|
268
|
+
|
269
|
+
To work on the `vagrant-aws` plugin, clone this repository out, and use
|
270
|
+
[Bundler](http://gembundler.com) to get the dependencies:
|
271
|
+
|
272
|
+
```
|
273
|
+
$ bundle
|
274
|
+
```
|
275
|
+
|
276
|
+
Once you have the dependencies, verify the unit tests pass with `rake`:
|
277
|
+
|
278
|
+
```
|
279
|
+
$ bundle exec rake
|
280
|
+
```
|
281
|
+
|
282
|
+
If those pass, you're ready to start developing the plugin. You can test
|
283
|
+
the plugin without installing it into your Vagrant environment by just
|
284
|
+
creating a `Vagrantfile` in the top level of this directory (it is gitignored)
|
285
|
+
and add the following line to your `Vagrantfile`
|
286
|
+
```ruby
|
287
|
+
Vagrant.require_plugin "vagrant-aws"
|
288
|
+
```
|
289
|
+
Use bundler to execute Vagrant:
|
290
|
+
```
|
291
|
+
$ bundle exec vagrant up --provider=aws
|
292
|
+
```
|
data/Rakefile
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'bundler/setup'
|
3
|
+
require 'rspec/core/rake_task'
|
4
|
+
|
5
|
+
# Immediately sync all stdout so that tools like buildbot can
|
6
|
+
# immediately load in the output.
|
7
|
+
$stdout.sync = true
|
8
|
+
$stderr.sync = true
|
9
|
+
|
10
|
+
# Change to the directory of this file.
|
11
|
+
Dir.chdir(File.expand_path("../", __FILE__))
|
12
|
+
|
13
|
+
# This installs the tasks that help with gem creation and
|
14
|
+
# publishing.
|
15
|
+
Bundler::GemHelper.install_tasks
|
16
|
+
|
17
|
+
# Install the `spec` task so that we can run tests.
|
18
|
+
RSpec::Core::RakeTask.new
|
19
|
+
|
20
|
+
# Default task is to run the unit tests
|
21
|
+
task :default => "spec"
|
22
|
+
|
23
|
+
# Load all the rake tasks from the "tasks" folder. This folder
|
24
|
+
# allows us to nicely separate rake tasks into individual files
|
25
|
+
# based on their role, which makes development and debugging easier
|
26
|
+
# than one monolithic file.
|
27
|
+
task_dir = File.expand_path("../tasks", __FILE__)
|
28
|
+
Dir["#{task_dir}/**/*.rake"].each do |task_file|
|
29
|
+
load task_file
|
30
|
+
end
|
31
|
+
|
data/Vagrantfile.orig
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
$script = <<SCRIPT
|
2
|
+
echo I am provisioning...
|
3
|
+
sudo apt-get install -y rbenv make ruby-dev libssl-dev libreadline-dev zlib1g-dev git bundler
|
4
|
+
export PATH="$HOME/.rbenv/bin:$PATH"
|
5
|
+
eval "$(rbenv init -)"
|
6
|
+
git clone https://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
|
7
|
+
SCRIPT
|
8
|
+
|
9
|
+
Vagrant.configure(2) do |config|
|
10
|
+
config.vm.box = "skytap/empty"
|
11
|
+
config.vm.synced_folder ".", "/vagrant", disabled: true
|
12
|
+
config.vm.provision "shell", inline: $script
|
13
|
+
|
14
|
+
config.vm.provider :skytap do |skytap, override|
|
15
|
+
skytap.username = "etrue"
|
16
|
+
skytap.api_token = "fcb2620b72efddbc8239e25db9d812f510c7e166"
|
17
|
+
end
|
18
|
+
|
19
|
+
GENERIC_UBUNTU = 'https://cloud.skytap.com/vms/6869434'
|
20
|
+
UBUNTU1 = "https://cloud.skytap.com/vms/7285844"
|
21
|
+
UBUNTU2 = "https://cloud.skytap.com/vms/7285846"
|
22
|
+
UBUNTU_WITH_VAGRANT = "https://cloud.skytap.com/vms/7397734"
|
23
|
+
|
24
|
+
|
25
|
+
config.vm.define "vm1" do |ubuntu|
|
26
|
+
ubuntu.vm.hostname = "vm1"
|
27
|
+
ubuntu.vm.provider :skytap do |box|
|
28
|
+
box.vm_url = UBUNTU_WITH_VAGRANT
|
29
|
+
end
|
30
|
+
ubuntu.vm.synced_folder "~/test1", "/synced", type: :nfs
|
31
|
+
ubuntu.ssh.username = "skytap"
|
32
|
+
ubuntu.ssh.password = "ChangeMe!"
|
33
|
+
end
|
34
|
+
end
|
data/bar/checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 24a1c03bc0e10db880d99fa3af00f067b4d13ea6
|
4
|
+
data.tar.gz: 92bf878a29425935dbc71fd9f7980915e3b36da9
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 35aaa99e4ff841a64266ea41f96ce8dbf6966a55cf047be2ae8ff54650ac93044767a14ff8f625ec9be9e0afd69327f407b2464c4829e2db9040570da9a99c8c
|
7
|
+
data.tar.gz: 6f9f5299c9dc295e6d7ff1ffec8f1d939b025ea00e8f669be9b3bb63104189a8a8a295aa613b0c306cae240bfb33e3a0c0a76eeb4523ebd68c01f45ab153a6e7
|
data/bar/data.tar
ADDED
Binary file
|