Implement Vagrant support.

This commit is contained in:
Gunnar Beutner 2013-10-10 14:57:17 +02:00
parent fdc3f32544
commit ebc92a0ba6
2 changed files with 50 additions and 0 deletions

11
Vagrantfile vendored Normal file
View File

@ -0,0 +1,11 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "centos64"
config.vm.box_url = "http://boxes.icinga.org/centos-64-x64-vbox4212.box"
config.vm.network :forwarded_port, guest: 80, host: 8080
config.vm.provision :shell, :path => "tools/vagrant-bootstrap.sh"
end

39
tools/vagrant-bootstrap.sh Executable file
View File

@ -0,0 +1,39 @@
#!/bin/sh
sed -i 's/^HOSTNAME=.*/HOSTNAME=icinga-demo.icinga.org/' /etc/sysconfig/network
hostname icinga-demo.icinga.org
rpm --import http://packages.icinga.org/icinga.key
wget http://packages.icinga.org/epel/6/snapshot/ICINGA-snapshot.repo -O /etc/yum.repos.d/ICINGA-snapshot.repo
yum makecache
yum install -y httpd
yum install -y --nogpgcheck icinga2 icinga-gui
chkconfig httpd on
chkconfig icinga off
chkconfig icinga2 on
/etc/init.d/icinga stop
/etc/init.d/icinga2 stop
wget http://ftp-stud.hs-esslingen.de/pub/epel/6/i386/epel-release-6-8.noarch.rpm -O /tmp/epel.rpm
yum install -y /tmp/epel.rpm
rm -f /tmp/epel.rpm
yum install -y nagios-plugins-all
ln -sf /var/cache/icinga2/status.dat /var/spool/icinga/status.dat
ln -sf /var/cache/icinga2/objects.cache /var/spool/icinga/objects.cache
ln -sf /var/run/icinga2/cmd/icinga2.cmd /var/icinga/cmd/icinga.cmd
ln -sf /var/log/icinga2/compat/icinga.log /var/log/icinga/icinga.log
rm -Rf /var/log/icinga/archives
ln -s /var/log/icinga2/compat/archives /var/log/icinga/
i2enfeature statusdat
i2enfeature compat-log
i2enfeature command
sed -i 's/lib/lib64/' /etc/icinga2/conf.d/macros.conf
/etc/init.d/httpd start
/etc/init.d/icinga2 start
iptables -I INPUT 2 -m tcp -p tcp --dport 80 -j ACCEPT
/etc/init.d/iptables save