forked from geerlingguy/ansible-for-devops
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Vagrantfile
38 lines (32 loc) · 1021 Bytes
/
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
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
# Base VM OS configuration.
config.vm.box = "geerlingguy/ubuntu2004"
config.vm.synced_folder '.', '/vagrant', disabled: true
config.ssh.insert_key = false
config.vm.provider :virtualbox do |v|
v.memory = 512
v.cpus = 1
end
# Define two VMs with static private IP addresses.
boxes = [
{ :name => "gluster1", :ip => "192.168.29.2" },
{ :name => "gluster2", :ip => "192.168.29.3" }
]
# Provision each of the VMs.
boxes.each do |opts|
config.vm.define opts[:name] do |config|
config.vm.hostname = opts[:name]
config.vm.network :private_network, ip: opts[:ip]
# Provision both VMs using Ansible after the last VM is booted.
if opts[:name] == "gluster2"
config.vm.provision "ansible" do |ansible|
ansible.playbook = "playbooks/provision.yml"
ansible.inventory_path = "inventory"
ansible.limit = "all"
end
end
end
end
end