forked from pwnall/igor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathVagrantfile
90 lines (74 loc) · 3 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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Supported values:
# fedora-23
#
# NOTE: ubuntu-xenial may be supported when it is released; wily does not have
# the packages required to be a master (etcd server, skydns) or a worker
# (etcd client)
OS = 'fedora-23'
# Number of worker VMs.
WORKERS = 1
Vagrant.configure(2) do |config|
config.vm.box = {
'ubuntu-wily' => 'ubuntu/wily64',
'ubuntu-xenial' => 'ubuntu/xenial64',
'fedora-23' => 'fedora/23-cloud-base',
}[OS]
config.vm.box_check_update = true
config.vm.box_url = {
'ubuntu-xenial' => 'https://cloud-images.ubuntu.com/xenial/current/xenial-server-cloudimg-amd64-vagrant.box',
}[OS]
# Create a forwarded port mapping which allows access to a specific port
# within the machine from a port on the host machine. In the example below,
# accessing "localhost:8080" will access port 80 on the guest machine.
# config.vm.network "forwarded_port", guest: 80, host: 8080
config.vm.network :private_network, type: :dhcp, nic_type: 'virtio'
config.vm.synced_folder '.', '/vagrant', disabled: true
config.vm.synced_folder '.', '/home/vagrant/sync', disabled: true
# NOTE: The master is the primary machine so that we can "vagrant ssh" into
# it without having to provide extra arguments.
config.vm.define "master", primary: true do |master|
end
1.upto WORKERS do |worker_id|
config.vm.define "worker#{worker_id}" do |worker|
# NOTE: The ansible provisioning block is only defined in the last
# worker, so it runs after all the VMs have been created.
if worker_id == WORKERS
worker.vm.provision :ansible do |ansible|
ansible.playbook = "deploy/ansible/prod.yml"
ansible.limit = "all"
# Simulate the groups produced by the OpenStack setup.
ansible.groups = {
"meta-system_role_vagrant_master" => ["master"],
"meta-system_role_vagrant_worker" =>
(1..WORKERS).map { |i| "worker#{i}" },
}
ansible.extra_vars = {
os_prefix: "vagrant",
os_image_user: "vagrant",
# This can be "main" for the current Docker release, "testing" for
# the next point release, or "experimental" for the next major
# release.
docker_engine_branch: "main",
# This can be "latest" for the current Docker Swarm release, or a
# specific tag from https://hub.docker.com/r/library/swarm/
docker_swarm_tag: "latest",
}
# Uncomment for Ansible role debugging.
# ansible.verbose = "vvv"
# Uncomment for Ansible connection debugging.
# ansible.verbose = "vvv"
end
end
end
end
config.vm.provider :virtualbox do |vb, override|
vb.memory = 2048
# The NAT network adapter uses the Intel PRO/1000MT adapter by default.
vb.customize ['modifyvm', :id, '--nictype1', 'virtio']
end
config.vm.provider :libvirt do |domain, override|
domain.memory = 1024
end
end