Permalink
Browse files

Add icinga2x-freebsd for testing purposes

  • Loading branch information...
1 parent dfc8020 commit 7b4e1d82e4706954c912e531bf0a898ad7f0f014 @dnsmichi dnsmichi committed Dec 7, 2016
Showing with 107 additions and 0 deletions.
  1. +1 −0 icinga2x-freebsd/.gitignore
  2. +37 −0 icinga2x-freebsd/README.md
  3. +69 −0 icinga2x-freebsd/Vagrantfile
@@ -0,0 +1 @@
+.vagrant
@@ -0,0 +1,37 @@
+# Purpose
+
+Test-Box for installing and running Icinga 2.
+
+No hostonly network available currently.
+
+# Run
+
+ $ vagrant up --provider virtualbox
+ $ vagrant ssh
+
+ $ sudo -i
+
+# Install Icinga 2
+
+ # env ASSUME_ALWAYS_YES=YES pkg install icinga2 wget curl gdb vim python
+
+ # sysrc icinga2_enable=yes
+
+ # icinga2 api setup
+
+ # cat >/usr/local/etc/icinga2/conf.d/api-users.conf <<EOF
+ object ApiUser "root" {
+ password = "icinga"
+ permissions = [ "*" ]
+ }
+ EOF
+
+ # service icinga2 restart
+
+# API tests
+
+ # curl -k -s -u root:icinga -H 'Accept: application/json' -X POST https://localhost:5665/v1/config/packages/example-cmdb
+
+ # curl -k -s -u root:icinga -H 'Accept: application/json' -X POST -d '{ "files": { "conf.d/test.conf": "object Host \"cmdb-host\" { chec_command = \"dummy\" }" } }' 'https://localhost:5665/v1/config/stages/example-cmdb' | python -m json.tool
+
+ # curl -k -s -u root:icinga -X GET 'https://localhost:5665/v1/config/files/example-cmdb/icinga2-freebsd-1481141308-4/startup.log'
@@ -0,0 +1,69 @@
+# -*- mode: ruby -*-
+# vi: set ft=ruby :
+
+VAGRANTFILE_API_VERSION = "2"
+VAGRANT_REQUIRED_VERSION = "1.6.5"
+
+# Require 1.6.5 at least
+if ! defined? Vagrant.require_version
+ if Gem::Version.new(Vagrant::VERSION) < Gem::Version.new(VAGRANT_REQUIRED_VERSION)
+ puts "Vagrant >= " + VAGRANT_REQUIRED_VERSION + " required. Your version is " + Vagrant::VERSION
+ exit 1
+ end
+else
+ Vagrant.require_version ">= " + VAGRANT_REQUIRED_VERSION
+end
+
+Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
+
+ servers = { 'icinga2-freebsd' => '192.168.33.9'
+ }
+ http_port = { 'icinga2-freebsd' => 8082
+ }
+ ssh_port = { 'icinga2-freebsd' => 2082
+ }
+
+ servers.each do |server_name, server_ip|
+ config.vm.define server_name do |app_config|
+
+ app_config.vm.base_mac = "080027D14C66"
+ app_config.vm.guest = :freebsd
+ app_config.vm.synced_folder ".", "/vagrant", disabled: true
+ app_config.ssh.shell = "bash"
+
+ # virtualbox
+ app_config.vm.provider :virtualbox do |v, override|
+ override.vm.box = "freebsd/FreeBSD-11.0-STABLE"
+
+ v.customize ["modifyvm", :id, "--memory", "2048"]
+ v.customize ["modifyvm", :id, "--cpus", "2"]
+ # Using the host's resolver as a DNS proxy in NAT mode
+ v.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
+
+ # network settings for FreeBSD
+ v.customize ["modifyvm", :id, "--hwvirtex", "on"]
+ v.customize ["modifyvm", :id, "--nictype1", "virtio"]
+ v.customize ["modifyvm", :id, "--nictype2", "virtio"]
+ end
+
+ # network config
+ app_config.vm.hostname = "#{server_name.to_s}"
+ app_config.vm.network :forwarded_port, guest: 22, host: ssh_port[server_name], auto_correct: true
+ app_config.vm.network :forwarded_port, guest: 80, host: http_port[server_name], auto_correct: true
+ #app_config.vm.network :private_network, ip: "#{server_ip}"
+
+ #app_config.vm.provision :shell, :path => "manifests/puppet.sh"
+
+ # provisioner
+ #app_config.vm.provision :puppet do |puppet|
+ # puppet.module_path = "../modules"
+ # puppet.manifests_path = "manifests"
+ # puppet.hiera_config_path = "hiera.yaml"
+ # #puppet.options = "--verbose --debug --parser=future"
+ # puppet.options = "--parser=future"
+ #end
+ #app_config.vm.provision :shell, :path => "manifests/finalize.sh"
+ end
+ end
+end
+

0 comments on commit 7b4e1d8

Please sign in to comment.