diff --git a/.vagrant-puppet/manifests/default.pp b/.vagrant-puppet/manifests/default.pp index 31e369c1b..72e04bcd0 100644 --- a/.vagrant-puppet/manifests/default.pp +++ b/.vagrant-puppet/manifests/default.pp @@ -1,7 +1,6 @@ include apache include mysql include pgsql -include php Exec { path => '/bin:/usr/bin:/sbin' } @@ -25,6 +24,9 @@ $icinga_packages = [ 'gcc', 'glibc', 'glibc-common', 'gd', 'gd-devel', 'libdbi-dbd-mysql', 'libdbi-dbd-pgsql' ] package { $icinga_packages: ensure => installed } +php::extension { ['php-mysql', 'php-pgsql']: + require => [Class['mysql'], Class['pgsql']] +} group { 'icinga-cmd': ensure => present @@ -48,10 +50,11 @@ cmmi { 'icinga-mysql': --enable-idoutils --with-init-dir=/tmp/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-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'], + require => [User['icinga'], Cmmi['icinga-plugins']], notify => Service["${apache::apache}"] } @@ -73,10 +76,11 @@ cmmi { 'icinga-pgsql': --with-init-dir=/tmp/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-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'], + require => [User['icinga'], Cmmi['icinga-plugins']], notify => Service["${apache::apache}"] } @@ -180,3 +184,14 @@ exec { 'icinga-htpasswd': command => 'mkdir /usr/share/icinga && htpasswd -b -c /usr/share/icinga/htpasswd.users icingaadmin icinga', require => Package["${apache::apache}"] } + +cmmi { 'icinga-plugins': + url => 'http://sourceforge.net/projects/nagiosplug/files/nagiosplug/1.4.16/nagios-plugins-1.4.16.tar.gz/download', + output => 'nagios-plugins-1.4.16.tar.gz', + flags => '--prefix=/usr/lib64/nagios/plugins \ + --with-nagios-user=icinga --with-nagios-group=icinga \ + --with-cgiurl=/icinga-mysql/cgi-bin', + creates => '/usr/lib64/nagios/plugins/libexec', + make => 'make && make install', + require => User['icinga'] +} diff --git a/.vagrant-puppet/modules/cmmi/manifests/init.pp b/.vagrant-puppet/modules/cmmi/manifests/init.pp index f8f224a89..4a9264ea6 100644 --- a/.vagrant-puppet/modules/cmmi/manifests/init.pp +++ b/.vagrant-puppet/modules/cmmi/manifests/init.pp @@ -31,25 +31,21 @@ define cmmi( $output, $flags, $creates, - $make='make all && make install', + $make, ) { Exec { path => '/bin:/usr/bin' } - if ! defined(Package['wget']) { - package{ 'wget': - ensure => installed - } - } - $cwd = '/usr/local/src' + include wget + exec { "download-${name}": cwd => $cwd, command => "wget -q ${url} -O ${output}", creates => "${cwd}/${output}", timeout => 120, - require => Package['wget'] + require => Class['wget'] } $tld = inline_template('<%= File.basename(output, ".tar.gz") %>') diff --git a/.vagrant-puppet/modules/php/manifests/extension.pp b/.vagrant-puppet/modules/php/manifests/extension.pp new file mode 100644 index 000000000..1e65f8474 --- /dev/null +++ b/.vagrant-puppet/modules/php/manifests/extension.pp @@ -0,0 +1,32 @@ +# define: php::extension +# +# Install additional PHP modules. +# +# Parameters: +# +# Actions: +# +# Requires: +# +# Sample Usage: +# +# php::extension { 'php-ldap': } +# php::extension { ['php-mysql'], ['php-pgsql']: } +# +define php::extension( + $ensure=installed +) { + + include php + + if $::require { + $require_ = [Class['php'], $::require] + } else { + $require_ = Class['php'] + } + + package { $name: + ensure => $ensure, + require => $require_ + } +} diff --git a/.vagrant-puppet/modules/php/manifests/init.pp b/.vagrant-puppet/modules/php/manifests/init.pp index 29efd08d0..8edbb31c1 100644 --- a/.vagrant-puppet/modules/php/manifests/init.pp +++ b/.vagrant-puppet/modules/php/manifests/init.pp @@ -1,6 +1,6 @@ # Class: php # -# This class installs the php and php-mysql packages. +# This class installs php. # # Parameters: # @@ -15,17 +15,6 @@ class php { package { 'php': - ensure => installed, - require => Package["${apache::apache}"] - } - - package { 'php-mysql': - ensure => installed, - require => Package['mysql-server'] - } - - package { 'php-pgsql': - ensure => installed, - require => Package['postgresql-server'] + ensure => installed } } diff --git a/.vagrant-puppet/modules/wget/manifests/init.pp b/.vagrant-puppet/modules/wget/manifests/init.pp new file mode 100644 index 000000000..560e10b2f --- /dev/null +++ b/.vagrant-puppet/modules/wget/manifests/init.pp @@ -0,0 +1,20 @@ +# Class: wget +# +# This class installs wget. +# +# Parameters: +# +# Actions: +# +# Requires: +# +# Sample Usage: +# +# include wget +# +class wget { + + package { 'wget': + ensure => installed, + } +} diff --git a/README.md b/README.md index ba301adfd..bb917ab89 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ 1. [Vagrant - Virtual development environment](#vagrant) -### Vagrant +## Vagrant The Icinga 2 Web project ships with a Vagrant virtual machine that integrates the source code with various services and example data in a controlled @@ -16,7 +16,7 @@ have to do is install Vagrant and run: After you should be able to browse [localhost:8080/icinga2-web](http://localhost:8080/icinga2-web). -#### Environment +### Environment **Forwarded ports**: @@ -40,8 +40,8 @@ After you should be able to browse [localhost:8080/icinga2-web](http://localhost **Installed packages**: -* Apache2 with PHP library -* PHP with MySQL libray +* Apache2 with PHP enabled +* PHP with MySQL and PostgreSQL libraries * MySQL server and client software * PostgreSQL server and client software * [Icinga prerequisites](http://docs.icinga.org/latest/en/quickstart-idoutils.html#installpackages) @@ -51,16 +51,17 @@ After you should be able to browse [localhost:8080/icinga2-web](http://localhost * User icinga with group icinga and icinga-cmd * Webserver user added to group icinga-cmd -**Installed files**: - -* `/usr/share/icinga/htpasswd.users` account information for logging into the Icinga classic web interface for both instances - **Installed software**: * Icinga 1.9.1 with IDOUtils using a MySQL database * Icinga 1.9.1 with IDOUtils using a PostgreSQL database -##### Icinga with IDOUtils using a MySQL database +**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 + +#### Icinga with IDOUtils using a MySQL database **Installation path**: `/usr/local/icinga-mysql` @@ -74,9 +75,9 @@ Connect to the **icinga mysql database** using the following command: mysql -u icinga -p icinga icinga Access the **Classic UI** (CGIs) via [localhost:8080/icinga-mysql](http://localhost:8080/icinga-mysql). -For logging into the Icinga classic web interface use user *icingaadmin* with password *icinga*. +For **logging into** the Icinga classic web interface use user *icingaadmin* with password *icinga*. -##### Icinga with IDOUtils using a PostgreSQL database +#### Icinga with IDOUtils using a PostgreSQL database **Installation path**: `/usr/local/icinga-pgsql` @@ -90,4 +91,4 @@ Connect to the **icinga mysql database** using the following command: sudo -u postgres psql -U icinga -d icinga Access the **Classic UI** (CGIs) via [localhost:8080/icinga-pgsql](http://localhost:8080/icinga-pgsql). -For logging into the Icinga classic web interface use user *icingaadmin* with password *icinga*. +For **logging into** the Icinga classic web interface use user *icingaadmin* with password *icinga*.