2014-09-08 12:24:28 +02:00
|
|
|
class icingaweb2_dev {
|
2014-09-10 11:45:57 +02:00
|
|
|
include apache
|
2014-09-10 18:27:27 +02:00
|
|
|
include php
|
2014-09-15 13:35:14 +02:00
|
|
|
include icingaweb2
|
2014-09-15 14:42:54 +02:00
|
|
|
include icingacli
|
2014-11-24 14:44:17 +01:00
|
|
|
include icinga_packages
|
2014-11-25 17:46:29 +01:00
|
|
|
include openldap
|
2014-09-11 11:30:24 +02:00
|
|
|
|
|
|
|
class { 'zend_framework':
|
|
|
|
notify => Service['apache'],
|
|
|
|
}
|
2014-09-10 11:45:57 +02:00
|
|
|
|
2014-10-30 17:25:41 +01:00
|
|
|
package { [ 'php-pdo', 'php-ldap', 'php-phpunit-PHPUnit', 'icinga-gui' ]:
|
2014-09-11 11:17:51 +02:00
|
|
|
ensure => latest,
|
|
|
|
notify => Service['apache'],
|
2014-11-24 14:44:17 +01:00
|
|
|
require => Class['icinga_packages'],
|
2014-09-11 11:17:51 +02:00
|
|
|
}
|
|
|
|
|
2014-09-15 14:42:54 +02:00
|
|
|
Exec { path => '/usr/local/bin:/usr/bin:/bin' }
|
2014-09-15 13:35:14 +02:00
|
|
|
|
|
|
|
file { '/etc/icingaweb/enabledModules':
|
|
|
|
ensure => directory,
|
|
|
|
owner => 'apache',
|
|
|
|
group => 'apache',
|
2014-10-30 14:02:48 +01:00
|
|
|
mode => 6755,
|
2014-09-15 13:35:14 +02:00
|
|
|
require => [
|
|
|
|
Class['apache'],
|
|
|
|
File['icingaweb2cfgDir']
|
|
|
|
],
|
|
|
|
}
|
|
|
|
-> exec { 'enable-monitoring-module':
|
2014-09-11 11:53:20 +02:00
|
|
|
command => 'icingacli module enable monitoring',
|
2014-09-15 14:20:13 +02:00
|
|
|
user => 'apache',
|
2014-09-15 14:42:54 +02:00
|
|
|
require => Class[[ 'icingacli', 'apache' ]],
|
2014-09-11 11:53:20 +02:00
|
|
|
}
|
2014-10-30 17:03:09 +01:00
|
|
|
-> exec { 'enable-test-module':
|
|
|
|
command => 'icingacli module enable test',
|
|
|
|
user => 'apache'
|
|
|
|
}
|
2014-09-11 11:53:20 +02:00
|
|
|
|
2014-09-15 16:17:04 +02:00
|
|
|
group { 'icingacmd':
|
|
|
|
ensure => present,
|
|
|
|
}
|
|
|
|
-> exec { 'usermod -aG icingacmd apache':
|
2014-09-12 19:03:17 +02:00
|
|
|
command => '/usr/sbin/usermod -aG icingacmd apache',
|
|
|
|
require => [
|
2014-09-15 14:42:54 +02:00
|
|
|
Class['icingacli'],
|
2014-09-12 19:03:17 +02:00
|
|
|
User['apache']
|
|
|
|
],
|
|
|
|
notify => Service['apache'],
|
|
|
|
}
|
|
|
|
|
2014-09-15 16:17:04 +02:00
|
|
|
file { '/var/log/icingaweb.log':
|
|
|
|
ensure => file,
|
|
|
|
owner => 'apache',
|
|
|
|
group => 'apache',
|
|
|
|
require => Class['apache'],
|
|
|
|
}
|
|
|
|
|
2014-09-09 13:19:12 +02:00
|
|
|
mysql::database::populate { 'icingaweb':
|
2014-09-02 12:21:28 +02:00
|
|
|
username => 'icingaweb',
|
|
|
|
password => 'icingaweb',
|
2014-08-06 13:27:16 +02:00
|
|
|
privileges => 'ALL',
|
2014-11-25 12:55:51 +01:00
|
|
|
schemafile => '/vagrant/etc/schema/mysql.schema.sql',
|
2014-08-06 13:27:16 +02:00
|
|
|
}
|
|
|
|
|
2014-09-09 13:19:12 +02:00
|
|
|
pgsql::database::populate { 'icingaweb':
|
2014-08-06 13:27:16 +02:00
|
|
|
username => 'icingaweb',
|
2014-09-09 15:15:53 +02:00
|
|
|
password => 'icingaweb',
|
2014-11-25 12:55:51 +01:00
|
|
|
schemafile => '/vagrant/etc/schema/pgsql.schema.sql',
|
2014-08-06 13:27:16 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
file { '/etc/httpd/conf.d/icingaweb.conf':
|
|
|
|
source => 'puppet:////vagrant/.vagrant-puppet/files/etc/httpd/conf.d/icingaweb.conf',
|
|
|
|
notify => Service['apache'],
|
|
|
|
}
|
|
|
|
|
2014-09-10 11:21:29 +02:00
|
|
|
icingaweb2::config::general { 'authentication':
|
2014-09-09 16:27:26 +02:00
|
|
|
source => 'puppet:///modules/icingaweb2_dev',
|
|
|
|
}
|
2014-08-06 13:27:16 +02:00
|
|
|
|
2014-09-10 11:21:29 +02:00
|
|
|
icingaweb2::config::general { [ 'resources', 'config' ]:
|
2014-09-09 15:15:53 +02:00
|
|
|
source => 'puppet:///modules/icingaweb2_dev',
|
|
|
|
replace => false,
|
2014-08-22 11:37:46 +02:00
|
|
|
}
|
|
|
|
|
2014-09-09 16:27:26 +02:00
|
|
|
icingaweb2::config::module { [ 'backends', 'config', 'instances' ]:
|
|
|
|
source => 'puppet:///modules/icingaweb2_dev',
|
|
|
|
}
|
2014-09-30 10:59:30 +02:00
|
|
|
|
|
|
|
package { 'iptables':
|
|
|
|
ensure => latest
|
|
|
|
}
|
|
|
|
-> exec { 'iptables-allow-http':
|
|
|
|
unless => 'grep -Fxqe "-A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT" /etc/sysconfig/iptables',
|
2014-10-21 12:22:17 +02:00
|
|
|
command => '/sbin/iptables -I INPUT 1 -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT && /sbin/iptables-save > /etc/sysconfig/iptables'
|
2014-09-30 10:59:30 +02:00
|
|
|
}
|
2014-11-25 17:46:29 +01:00
|
|
|
|
|
|
|
define openldap_file {
|
|
|
|
file { "openldap/${name}.ldif":
|
|
|
|
path => "/usr/share/openldap-servers/${name}.ldif",
|
|
|
|
source => "puppet:///modules/icingaweb2_dev/openldap/${name}.ldif",
|
|
|
|
require => Class['openldap'],
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
openldap_file { [ 'db', 'dit', 'users' ]: }
|
|
|
|
|
|
|
|
exec { 'populate-openldap':
|
|
|
|
# TODO: Split the command and use unless instead of trying to populate openldap everytime
|
|
|
|
command => 'sudo ldapadd -c -Y EXTERNAL -H ldapi:/// -f /usr/share/openldap-servers/db.ldif || true && \
|
|
|
|
sudo ldapadd -c -D cn=admin,dc=icinga,dc=org -x -w admin -f /usr/share/openldap-servers/dit.ldif || true && \
|
|
|
|
sudo ldapadd -c -D cn=admin,dc=icinga,dc=org -x -w admin -f /usr/share/openldap-servers/users.ldif || true',
|
|
|
|
require => [
|
|
|
|
Service['slapd'],
|
|
|
|
File[[
|
|
|
|
'openldap/db.ldif',
|
|
|
|
'openldap/dit.ldif',
|
|
|
|
'openldap/users.ldif'
|
|
|
|
]]
|
|
|
|
],
|
|
|
|
}
|
2014-08-06 13:27:16 +02:00
|
|
|
}
|