From 69400ce6712a6a9f53e20668ce980cbc4a1678d2 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Mon, 22 Jul 2013 14:47:33 +0200 Subject: [PATCH 1/2] Vagrant: Update Icinga to 1.9.3 and Icinga 2 to 0.0.2 refs #4385 --- .vagrant-puppet/manifests/default.pp | 49 ++++++++++--------- .../modules/cmmi/manifests/init.pp | 7 +-- .../modules/php/manifests/extension.pp | 8 +-- README.md | 8 +-- Vagrantfile | 13 ++--- 5 files changed, 42 insertions(+), 43 deletions(-) diff --git a/.vagrant-puppet/manifests/default.pp b/.vagrant-puppet/manifests/default.pp index ccc47103d..328f116f2 100644 --- a/.vagrant-puppet/manifests/default.pp +++ b/.vagrant-puppet/manifests/default.pp @@ -41,80 +41,80 @@ user { 'icinga': user { 'apache': groups => 'icinga-cmd', - require => [Package["${apache::apache}"], Group['icinga-cmd']] + require => [Class['apache'], Group['icinga-cmd']] } cmmi { 'icinga-mysql': - url => 'http://sourceforge.net/projects/icinga/files/icinga/1.9.1/icinga-1.9.1.tar.gz/download', - output => 'icinga-1.9.1.tar.gz', + url => 'http://sourceforge.net/projects/icinga/files/icinga/1.9.3/icinga-1.9.3.tar.gz/download', + output => 'icinga-1.9.3.tar.gz', flags => '--prefix=/usr/local/icinga-mysql --with-command-group=icinga-cmd \ - --enable-idoutils --with-init-dir=/tmp/icinga-mysql/etc/init.d \ + --enable-idoutils --with-init-dir=/usr/local/icinga-mysql/etc/init.d \ --with-htmurl=/icinga-mysql --with-httpd-conf-file=/etc/httpd/conf.d/icinga-mysql.conf \ --with-cgiurl=/icinga-mysql/cgi-bin \ --with-http-auth-file=/usr/share/icinga/htpasswd.users \ --with-plugin-dir=/usr/lib64/nagios/plugins/libexec', creates => '/usr/local/icinga-mysql', make => 'make all && make fullinstall install-config', - require => [User['icinga'], Cmmi['icinga-plugins']], - notify => Service["${apache::apache}"] + require => [User['icinga'], Cmmi['icinga-plugins'], Package['apache']], + notify => Service['apache'] } file { '/etc/init.d/icinga-mysql': - source => '/tmp/icinga-mysql/etc/init.d/icinga', + source => '/usr/local/icinga-mysql/etc/init.d/icinga', require => Cmmi['icinga-mysql'] } file { '/etc/init.d/ido2db-mysql': - source => '/tmp/icinga-mysql/etc/init.d/ido2db', + source => '/usr/local/icinga-mysql/etc/init.d/ido2db', require => Cmmi['icinga-mysql'] } cmmi { 'icinga-pgsql': - url => 'http://sourceforge.net/projects/icinga/files/icinga/1.9.1/icinga-1.9.1.tar.gz/download', - output => 'icinga-1.9.1.tar.gz', + url => 'http://sourceforge.net/projects/icinga/files/icinga/1.9.3/icinga-1.9.3.tar.gz/download', + output => 'icinga-1.9.3.tar.gz', flags => '--prefix=/usr/local/icinga-pgsql \ --with-command-group=icinga-cmd --enable-idoutils \ - --with-init-dir=/tmp/icinga-pgsql/etc/init.d \ + --with-init-dir=/usr/local/icinga-pgsql/etc/init.d \ --with-htmurl=/icinga-pgsql --with-httpd-conf-file=/etc/httpd/conf.d/icinga-pgsql.conf \ --with-cgiurl=/icinga-pgsql/cgi-bin \ --with-http-auth-file=/usr/share/icinga/htpasswd.users \ --with-plugin-dir=/usr/lib64/nagios/plugins/libexec', creates => '/usr/local/icinga-pgsql', make => 'make all && make fullinstall install-config', - require => [User['icinga'], Cmmi['icinga-plugins']], - notify => Service["${apache::apache}"] + require => [User['icinga'], Cmmi['icinga-plugins'], Package['apache']], + notify => Service['apache'] } file { '/etc/init.d/icinga-pgsql': - source => '/tmp/icinga-pgsql/etc/init.d/icinga', + source => '/usr/local/icinga-pgsql/etc/init.d/icinga', require => Cmmi['icinga-pgsql'] } file { '/etc/init.d/ido2db-pgsql': - source => '/tmp/icinga-pgsql/etc/init.d/ido2db', + source => '/usr/local/icinga-pgsql/etc/init.d/ido2db', require => Cmmi['icinga-pgsql'] } exec { 'populate-icinga-mysql-db': unless => 'mysql -uicinga -picinga icinga -e "SELECT * FROM icinga_dbversion;" &> /dev/null', - command => 'mysql -uicinga -picinga icinga < /usr/local/src/icinga-mysql/icinga-1.9.1/module/idoutils/db/mysql/mysql.sql', + command => 'mysql -uicinga -picinga icinga < /usr/local/src/icinga-mysql/icinga-1.9.3/module/idoutils/db/mysql/mysql.sql', require => [Cmmi['icinga-mysql'], Exec['create-mysql-icinga-db']] } exec { 'populate-icinga-pgsql-db': unless => 'psql -U icinga -d icinga -c "SELECT * FROM icinga_dbversion;" &> /dev/null', - command => 'sudo -u postgres psql -U icinga -d icinga < /usr/local/src/icinga-pgsql/icinga-1.9.1/module/idoutils/db/pgsql/pgsql.sql', + command => 'sudo -u postgres psql -U icinga -d icinga < /usr/local/src/icinga-pgsql/icinga-1.9.3/module/idoutils/db/pgsql/pgsql.sql', require => [Cmmi['icinga-pgsql'], Exec['create-pgsql-icinga-db']] } service { 'icinga-mysql': ensure => running, - require => Cmmi['icinga-mysql'] + require => File['/etc/init.d/icinga-mysql'] } service { 'ido2db-mysql': ensure => running, - require => Cmmi['icinga-mysql'] + require => File['/etc/init.d/ido2db-mysql'] } file { '/usr/local/icinga-mysql/etc/ido2db.cfg': @@ -183,7 +183,7 @@ exec { 'iptables-allow-http': exec { 'icinga-htpasswd': creates => '/usr/share/icinga/htpasswd.users', command => 'mkdir /usr/share/icinga && htpasswd -b -c /usr/share/icinga/htpasswd.users icingaadmin icinga', - require => Package["${apache::apache}"] + require => Class['apache'] } cmmi { 'icinga-plugins': @@ -318,13 +318,13 @@ package { 'boost-devel': } cmmi { 'icinga2': - url => 'http://sourceforge.net/projects/icinga/files/icinga2/0.0.1/icinga2-0.0.1.tar.gz/download', - output => 'icinga2-0.0.1.tar.gz', + url => 'http://sourceforge.net/projects/icinga/files/icinga2/0.0.2/icinga2-0.0.2.tar.gz/download', + output => 'icinga2-0.0.2.tar.gz', flags => '--prefix=/usr/local/icinga2', creates => '/usr/local/icinga2', make => 'make && make install', require => Package['boost-devel'], - make_timeout => 600 + make_timeout => 900 } file { 'icinga2-web-public': @@ -335,7 +335,8 @@ file { 'icinga2-web-public': file { '/etc/httpd/conf.d/icinga2-web.conf': source => 'puppet:////vagrant/.vagrant-puppet/files/etc/httpd/conf.d/icinga2-web.conf', - notify => Service["${apache::apache}"] + require => Package['apache'], + notify => Service['apache'] } exec { 'install php-ZendFramework-Db-Adapter-Pdo-Mysql': diff --git a/.vagrant-puppet/modules/cmmi/manifests/init.pp b/.vagrant-puppet/modules/cmmi/manifests/init.pp index 225045c85..c2d7b71f6 100644 --- a/.vagrant-puppet/modules/cmmi/manifests/init.pp +++ b/.vagrant-puppet/modules/cmmi/manifests/init.pp @@ -45,7 +45,7 @@ define cmmi( exec { "download-${name}": cwd => $cwd, - command => "wget -q ${url} -O ${output}", + command => "wget -q \"${url}\" -O ${output}", creates => "${cwd}/${output}", require => Class['wget'] } @@ -55,8 +55,9 @@ define cmmi( exec { "extract-${name}": cwd => $cwd, - command => "mkdir -p ${name} && tar --no-same-owner \ - --no-same-permissions -xzf ${output} -C ${name}", + command => "mkdir -p ${name}/${tld} && tar --no-same-owner \ + --no-same-permissions -xzf ${output} -C ${name}/${tld} \ + --strip-components 1", creates => $src, require => Exec["download-${name}"] } diff --git a/.vagrant-puppet/modules/php/manifests/extension.pp b/.vagrant-puppet/modules/php/manifests/extension.pp index 1e65f8474..23cfe6029 100644 --- a/.vagrant-puppet/modules/php/manifests/extension.pp +++ b/.vagrant-puppet/modules/php/manifests/extension.pp @@ -17,16 +17,18 @@ define php::extension( $ensure=installed ) { + include apache include php if $::require { - $require_ = [Class['php'], $::require] + $require_ = [Package['apache'], Class['php'], $::require] } else { - $require_ = Class['php'] + $require_ = [Package['apache'], Class['php']] } package { $name: ensure => $ensure, - require => $require_ + require => $require_, + notify => Service['apache'] } } diff --git a/README.md b/README.md index d36732537..fe587e3c5 100644 --- a/README.md +++ b/README.md @@ -57,14 +57,14 @@ After you should be able to browse [localhost:8080/icinga2-web](http://localhost **Installed software**: -* Icinga 1.9.1 with IDOUtils using a MySQL database -* Icinga 1.9.1 with IDOUtils using a PostgreSQL database -* Icinga 2 version 0.0.1 +* Icinga with IDOUtils using a MySQL database +* Icinga with IDOUtils using a PostgreSQL database +* Icinga 2 **Installed files**: * `/usr/share/icinga/htpasswd.users` account information for logging into the Icinga classic web interface for both icinga instances -* `/usr/lib64/nagios/plugins` Nagios Plugins 1.4.16 for both icinga instances +* `/usr/lib64/nagios/plugins` Nagios Plugins for both icinga instances #### Icinga with IDOUtils using a MySQL database diff --git a/Vagrantfile b/Vagrantfile index 79419bad3..3b22d18d2 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -47,9 +47,8 @@ Vagrant::Config.run do |config| # Share an additional folder to the guest VM. The first argument is # an identifier, the second is the path on the guest to mount the # folder, and the third is the path on the host to the actual folder. - # # config.vm.share_folder "v-icinga2-web-pub", "/var/www/html/icinga2-web", "./pub" - config.vm.share_folder "v-test", "/vagrant/config", "./config", :owner => 'vagrant', :group => 'apache', :extra => 'dmode=775,fmode=775' - config.vm.customize ["setextradata", :id, "VBoxInternal2/SharedFoldersEnableSymlinksCreate/v-test", "1"] + config.vm.share_folder "v-icinga2web-conf.d", "/vagrant/config", "./config" + config.vm.customize ["setextradata", :id, "VBoxInternal2/SharedFoldersEnableSymlinksCreate/v-icinga2web-conf.d", "1"] # Enable provisioning with Puppet stand alone. Puppet manifests # are contained in a directory path relative to this Vagrantfile. @@ -58,12 +57,8 @@ Vagrant::Config.run do |config| config.vm.provision :puppet do |puppet| puppet.module_path = ".vagrant-puppet/modules" puppet.manifests_path = ".vagrant-puppet/manifests" - # # puppet.options = "-v -d" + # puppet.options = "-v -d" end - # The npm module jquery won't install via puppet because of an mysterious error - # when node-gyp rebuilding the dependent contextify module - config.vm.provision :shell do |shell| - shell.inline = "[ -d /usr/lib/node_modules/jquery ] || npm install --silent -g jquery" - end + config.vm.provision :shell, :path => ".vagrant-puppet/manifests/finalize.sh" end From 008d51034d9bca1cdf046259da70f20d949c50d8 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Mon, 22 Jul 2013 17:24:56 +0200 Subject: [PATCH 2/2] Vagrant: Add missing manifest finalize.sh refs #4385 --- .vagrant-puppet/manifests/finalize.sh | 17 +++++++++++++++++ .vagrant-puppet/modules/php/manifests/init.pp | 14 +++++++++++++- .../php/templates/error_reporting.ini.erb | 4 ++++ 3 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 .vagrant-puppet/manifests/finalize.sh create mode 100644 .vagrant-puppet/modules/php/templates/error_reporting.ini.erb diff --git a/.vagrant-puppet/manifests/finalize.sh b/.vagrant-puppet/manifests/finalize.sh new file mode 100644 index 000000000..ab43f5140 --- /dev/null +++ b/.vagrant-puppet/manifests/finalize.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +installJquery () { + # The npm module jquery won't install via puppet because of an mysterious error + # when node-gyp rebuilding the dependent contextify module + if [ ! -d /usr/lib/node_modules/jquery ]; then + npm install --silent -g jquery + fi +} + +mountIcinga2webConfd () { + # Remount /vagrant/config with appropriate permissions since the group apache is missing initially + mount -t vboxsf -o uid=`id -u vagrant`,gid=`id -g apache`,dmode=775,fmode=775 v-icinga2web-conf.d /vagrant/config +} + +installJquery +mountIcinga2webConfd diff --git a/.vagrant-puppet/modules/php/manifests/init.pp b/.vagrant-puppet/modules/php/manifests/init.pp index 8edbb31c1..36b6b09ac 100644 --- a/.vagrant-puppet/modules/php/manifests/init.pp +++ b/.vagrant-puppet/modules/php/manifests/init.pp @@ -8,13 +8,25 @@ # # Requires: # +# apache +# # Sample Usage: # # include php # class php { + include apache + package { 'php': - ensure => installed + ensure => installed, + require => Package['apache'], + notify => Service['apache'] + } + + file { '/etc/php.d/error_reporting.ini': + content => template('php/error_reporting.ini.erb'), + require => Package['php'], + notify => Service['apache'] } } diff --git a/.vagrant-puppet/modules/php/templates/error_reporting.ini.erb b/.vagrant-puppet/modules/php/templates/error_reporting.ini.erb new file mode 100644 index 000000000..d37dcd415 --- /dev/null +++ b/.vagrant-puppet/modules/php/templates/error_reporting.ini.erb @@ -0,0 +1,4 @@ +error_reporting = E_ALL | E_STRICT +display_errors = On +display_startup_errors = On +html_errors = On