forked from jrxFive/python-nomad
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Vagrantfile
60 lines (46 loc) · 1.27 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 = "192.168.33.10"
NOMAD_VERSION = "0.8.3"
NOMAD_PORT_GUEST = 4646
NOMAD_PORT_HOST = 4646
Vagrant.configure(2) do |config|
config.vm.box = "centos/7"
config.vm.network "forwarded_port", guest: NOMAD_PORT_GUEST, host: NOMAD_PORT_HOST
config.vm.network "private_network", ip: "#{IP}"
config.vm.provider "virtualbox" do |vb|
vb.name = "python-nomad"
vb.gui = false
vb.memory = "1024"
end
config.vm.provision "shell", inline: <<-SHELL
if [ ! -e /etc/yum.repos.d/docker.repo ]
then
tee /etc/yum.repos.d/docker.repo <<-EOF
[dockerrepo]
name=Docker Repository
baseurl=https://yum.dockerproject.org/repo/main/centos/7/
enabled=1
gpgcheck=1
gpgkey=https://yum.dockerproject.org/gpg
EOF
fi
yum -y install docker-engine unzip wget net-tools
usermod -aG docker vagrant
systemctl enable docker; systemctl start docker
wget -q -P /tmp/ https://releases.hashicorp.com/nomad/#{NOMAD_VERSION}/nomad_#{NOMAD_VERSION}_linux_amd64.zip
yes | unzip -d /tmp /tmp/nomad_#{NOMAD_VERSION}_linux_amd64.zip
if [ ! -f /usr/bin/nomad ]
then
cp /tmp/nomad /usr/bin/.
fi
if [ $(pgrep nomad) ]
then
echo "Nomad running"
else
echo "Starting Nomad"
nohup nomad agent -dev -bind #{IP} -node pynomad1 --acl-enabled > /dev/null 2>&1 &
sleep 30
fi
SHELL
end