-
Notifications
You must be signed in to change notification settings - Fork 0
/
Vagrantfile
57 lines (49 loc) · 1.83 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
# -*- mode: ruby -*-
# vi: set ft=ruby :
require 'yaml'
BOX_USERNAME = 'vagrant'.freeze
VAGRANT_API_VERSION = '2'.freeze
BOX = {
'name' => ENV.fetch('NOFOLLOW_VAGRANT_BOX_NAME', 'nofollow-dev'),
'ip' => ENV.fetch('NOFOLLOW_VAGRANT_BOX_IP', '192.168.23.15'),
'memory' => ENV.fetch('NOFOLLOW_VAGRANT_BOX_MEMORY', 4096),
'cpus' => ENV.fetch('NOFOLLOW_VAGRANT_BOX_CPUS', 2)
}.freeze
ANSIBLE = {
'config_file' => ENV.fetch(
'NOFOLLOW_ANSIBLE_CONFIG_FILE', 'ansible/ansible.cfg'
),
'playbook' => ENV.fetch(
'NOFOLLOW_ANSIBLE_PLAYBOOK_NAME', 'ansible/vagrant.yml'
)
}.freeze
Vagrant.configure(VAGRANT_API_VERSION) do |config|
# required to clone gits
config.ssh.forward_agent = true
config.vm.box = 'ubuntu/bionic64'
config.vm.box_check_update = false
# Setup ansible
config.vm.provision 'ansible' do |ansible|
ansible.compatibility_mode = '2.0'
ansible.config_file = ANSIBLE['config_file']
ansible.playbook = ANSIBLE['playbook']
ansible.extra_vars = Hash['public_ip' => BOX['ip']]
ansible.galaxy_roles_path = ANSIBLE['galaxy_roles_path']
end
config.vm.define BOX['name'], primary: true do |default|
default.vm.hostname = "#{BOX['name']}.local"
default.vm.network :private_network, ip: BOX['ip']
default.vm.network 'forwarded_port', guest: 8000, host: 8000
default.vm.synced_folder '.', '/vagrant', disabled: true
default.vm.synced_folder '.', "/home/#{BOX_USERNAME}/code"
default.vm.provider :virtualbox do |virtualbox|
virtualbox.customize ['modifyvm', :id, '--name', BOX['name']]
virtualbox.customize ['modifyvm', :id, '--memory', BOX['memory']]
virtualbox.customize ['modifyvm', :id, '--cpus', BOX['cpus']]
end
# Fixing locale issue
default.vm.provision :shell, :inline => <<-EOT
echo 'LC_ALL="en_US.UTF-8"' > /etc/default/locale
EOT
end
end