mirror of
https://codeberg.org/scottslowe/learning-tools.git
synced 2026-03-11 09:04:37 +00:00
40 lines
1.3 KiB
Ruby
40 lines
1.3 KiB
Ruby
# -*- mode: ruby -*-
|
|
# vi: set ft=ruby :
|
|
|
|
# Require the AWS provider plugin and YAML module
|
|
require 'vagrant-aws'
|
|
require 'yaml'
|
|
|
|
# Read YAML file with instance information
|
|
instances = YAML.load_file(File.join(File.dirname(__FILE__), 'instances.yml'))
|
|
|
|
# Specify Vagrant version and Vagrant API version
|
|
Vagrant.require_version '>= 1.6.0'
|
|
VAGRANTFILE_API_VERSION = '2'
|
|
ENV['VAGRANT_DEFAULT_PROVIDER'] = 'aws'
|
|
|
|
# Create and configure the AWS instance(s)
|
|
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
|
|
|
|
# Use dummy AWS box
|
|
config.vm.box = 'aws-dummy'
|
|
|
|
# Specify AWS authentication information
|
|
config.vm.provider 'aws' do |aws, override|
|
|
# Specify access/authentication information, keypair
|
|
aws.access_key_id = ENV['AWS_ACCESS_KEY_ID']
|
|
aws.secret_access_key = ENV['AWS_SECRET_ACCESS_KEY']
|
|
aws.keypair_name = instances['keypair_name']
|
|
|
|
# Specify region and AMI ID
|
|
aws.region = instances['region']
|
|
aws.ami = instances['ami']
|
|
aws.security_groups = instances['security_groups']
|
|
aws.instance_type = instances['instance_type']
|
|
|
|
# Specify username and private key path
|
|
override.ssh.username = instances['user']
|
|
# Edit the following line with you correct information
|
|
override.ssh.private_key_path = '~/.ssh/aws_rsa'
|
|
end # config.vm.provider 'aws'
|
|
end # Vagrant.configure
|