[icinga-checkins] icinga.org: icinga-vagrant/master: Add icinga2x-freebsd for testing purposes

git at icinga.org git at icinga.org
Wed Dec 7 21:16:02 CET 2016


Module: icinga-vagrant
Branch: master
Commit: 7b4e1d82e4706954c912e531bf0a898ad7f0f014
URL:    https://git.icinga.org/?p=icinga-vagrant.git;a=commit;h=7b4e1d82e4706954c912e531bf0a898ad7f0f014

Author: Michael Friedrich <michael.friedrich at icinga.com>
Date:   Wed Dec  7 21:15:47 2016 +0100

Add icinga2x-freebsd for testing purposes

---

 icinga2x-freebsd/.gitignore  |    1 +
 icinga2x-freebsd/README.md   |   37 ++++++++++++++++++++++
 icinga2x-freebsd/Vagrantfile |   69 ++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 107 insertions(+)

diff --git a/icinga2x-freebsd/.gitignore b/icinga2x-freebsd/.gitignore
new file mode 100644
index 0000000..8000dd9
--- /dev/null
+++ b/icinga2x-freebsd/.gitignore
@@ -0,0 +1 @@
+.vagrant
diff --git a/icinga2x-freebsd/README.md b/icinga2x-freebsd/README.md
new file mode 100644
index 0000000..a8c3183
--- /dev/null
+++ b/icinga2x-freebsd/README.md
@@ -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'
diff --git a/icinga2x-freebsd/Vagrantfile b/icinga2x-freebsd/Vagrantfile
new file mode 100644
index 0000000..c7611df
--- /dev/null
+++ b/icinga2x-freebsd/Vagrantfile
@@ -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
+



More information about the icinga-checkins mailing list