forked from projectatomic/adb-atomic-developer-bundle
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Vagrantfile
60 lines (48 loc) · 1.75 KB
/
Vagrantfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# -*- mode: ruby -*-
# vi: set ft=ruby :
IP_ADDRESS="10.2.2.2"
REQUIRED_PLUGINS = %w(vagrant-service-manager)
errors = []
def message(name)
"#{name} plugin is not installed, run `vagrant plugin install #{name}` to install it."
end
# Validate and collect error message if plugin is not installed
REQUIRED_PLUGINS.each { |plugin| errors << message(plugin) unless Vagrant.has_plugin?(plugin) }
unless errors.empty?
msg = errors.size > 1 ? "Errors: \n* #{errors.join("\n* ")}" : "Error: #{errors.first}"
fail Vagrant::Errors::VagrantError.new, msg
end
Vagrant.configure("2") do |config|
config.vm.box = "projectatomic/adb"
config.vm.provider "virtualbox" do |v, override|
v.memory = 2048
v.cpus = 2
end
config.vm.provider "libvirt" do |v, override|
v.driver = "kvm"
v.memory = 2048
v.cpus = 2
end
config.vm.provider "openstack" do |os|
# Specify OpenStack authentication information
os.openstack_auth_url = ENV['OS_AUTH_URL']
os.tenant_name = ENV['OS_TENANT_NAME']
os.username = ENV['OS_USERNAME']
os.password = ENV['OS_PASSWORD']
# Specify instance information
os.server_name = ENV['OS_INSTANCE']
os.flavor = ENV['OS_FLAVOR']
os.image = ENV['OS_IMAGE']
os.floating_ip_pool = ENV['OS_FLOATING_IP_POOL']
os.security_groups = ['default', ENV['OS_SECURITY_GROUP']]
os.keypair_name = ENV['OS_KEYPAIR_NAME']
config.ssh.private_key_path = ENV['OS_PRIVATE_KEYPATH']
config.ssh.username = 'vagrant'
end
config.vm.provision "shell", run: "always", inline: <<-SHELL
sudo yum -y install epel-release
sudo yum -y install ansible
sudo ansible-playbook -e ip_address=#{IP_ADDRESS} /vagrant/provisioning/playbook.yml
SHELL
config.vm.network "private_network", ip: "#{IP_ADDRESS}"
end