-
Notifications
You must be signed in to change notification settings - Fork 22
/
Vagrantfile
76 lines (61 loc) · 2.37 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
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
#yum update -y
$bootstrap_linux = <<SCRIPT
rpm -i https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm
yum install -y autoconf automake gcc gcc-g++ libtool libxml2-devel m4 make \
openssl libssl-devel pkg-config libxslt-devel \
libcurl4-openssl-dev xsltproc git curl-devel \
libxml2-python libxslt-python doxygen munin munin-node \
libpcap-devel httpd bison flex
wget -q https://homeproj.cesnet.cz/rpm/liberouter/devel/x86_64/libnf-1.17-1.x86_64.rpm
wget -q https://homeproj.cesnet.cz/rpm/liberouter/devel/x86_64/libnf-devel-1.17-1.x86_64.rpm
wget -q https://homeproj.cesnet.cz/rpm/liberouter/devel/x86_64/libnf-debuginfo-1.17-1.x86_64.rpm
yum install -y ./libnf*
yum clean all
SCRIPT
$install_nemea = <<SCRIPT
cd /root/
git clone --recursive --depth 10 https://github.com/CESNET/nemea
cd nemea
./bootstrap.sh&&./configure --prefix=/usr --bindir=/usr/bin/nemea --sysconfdir=/etc/nemea --libdir=/usr/lib64 -q&&make -j5 install
ldconfig
mkdir -p /var/log/nemea-supervisor
echo "export PATH=\$PATH:/usr/bin/nemea/" > /etc/profile.d/nemea.sh
SCRIPT
$run_supervisor = <<SCRIPT
/usr/bin/nemea/set_default_nic.sh /etc/nemea/supervisor_config.xml
service nemea-supervisor restart
chkconfig nemea-supervisor on
SCRIPT
$run_munin = <<SCRIPT
cat > /etc/httpd/conf.d/munin.conf <<SCRIPT2
<Directory /var/www/html/munin/>
Order Allow,Deny
Allow from all
</Directory>
SCRIPT2
ln -s /usr/share/munin/plugins/nemea_supervisor /etc/munin/plugins/
service httpd restart
service munin-node start
chkconfig munin-node on
chkconfig httpd on
SCRIPT
$run_iptables = <<SCRIPT
iptables -I INPUT 2 -p TCP --dport 830 -j ACCEPT
iptables -I INPUT 2 -p TCP --dport 80 -j ACCEPT
SCRIPT
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.define "Nemea-Demo" do |nemeademo|
nemeademo.vm.box = "cesnet/nemea-2-1-0"
# If private network is needed due to communication with other VMs:
#nemeademo.vm.network "private_network", :type => 'dhcp'
nemeademo.vm.provision :shell, inline: $bootstrap_linux
nemeademo.vm.provision :shell, inline: $install_nemea
nemeademo.vm.provision :shell, inline: $run_supervisor
nemeademo.vm.provision :shell, inline: $run_munin
nemeademo.vm.provision :shell, inline: $run_iptables
end
end