Merge branch 'feature/deduplicate-puppet-code-6842'
Puppet code still not perfect but good enough to replace the old stuff. resolves #6842
This commit is contained in:
commit
08473ff5c9
|
@ -2,4 +2,4 @@
|
|||
.git* export-ignore
|
||||
|
||||
# Normalize puppet manifests' line endings to LF on checkin and prevent conversion to CRLF when the files are checked out
|
||||
.vagrant-puppet/* eol=lf
|
||||
.puppet* eol=lf
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
# Except those related to git and vagrant
|
||||
!.git*
|
||||
!.vagrant-puppet/*
|
||||
!.puppet*
|
||||
|
||||
# Exclude application log files
|
||||
var/log/*
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
Fix steps that are always provisioned:
|
||||
|
||||
==> default: Notice: /Stage[main]/Icinga2/Icinga2::Feature[statusdata]/Parent_dirs[/etc/icinga2/features-enabled/statusdata.conf]/Exec[parent_dirs-/etc/icinga2/features-enabled/statusdata.conf]/returns: executed successfully
|
||||
==> default: Notice: /Stage[main]/Icinga2_dev/Icinga2::Config[constants]/Parent_dirs[/etc/icinga2/constants.conf]/Exec[parent_dirs-/etc/icinga2/constants.conf]/returns: executed successfully
|
||||
==> default: Notice: /Stage[main]/Icinga2_dev/Icinga2::Config[conf.d/commands]/Parent_dirs[/etc/icinga2/conf.d/commands.conf]/Exec[parent_dirs-/etc/icinga2/conf.d/commands.conf]/returns: executed successfully
|
||||
==> default: Notice: /Stage[main]/Icinga2/Icinga2::Feature[command]/Parent_dirs[/etc/icinga2/features-enabled/command.conf]/Exec[parent_dirs-/etc/icinga2/features-enabled/command.conf]/returns: executed successfully
|
||||
==> default: Notice: /Stage[main]/Icingaweb2_dev/Pgsql::Database::Populate[icingaweb]/Exec[populate-icingaweb-pgsql-db]/returns: executed successfully
|
||||
==> default: Notice: /Stage[main]/Php/Exec[php-timezone]/returns: executed successfully
|
||||
==> default: Notice: /Stage[main]/Icinga2_dev/Icinga2::Config[conf.d/test-config]/Parent_dirs[/etc/icinga2/conf.d/test-config.conf]/Exec[parent_dirs-/etc/icinga2/conf.d/test-config.conf]/returns: executed successfully
|
||||
==> default: Notice: /Stage[main]/Icingaweb2_dev/Exec[populate-openldap]/returns: executed successfully
|
||||
==> default: Notice: /Stage[main]/Monitoring_test_config/Git_cmmi[Monitoring-Generator-TestConfig]/Cmmi_dir[Monitoring-Generator-TestConfig]/Exec[configure-Monitoring-Generator-TestConfig]/returns: executed successfully
|
||||
==> default: Notice: /Stage[main]/Monitoring_test_config/Git_cmmi[Monitoring-Generator-TestConfig]/Cmmi_dir[Monitoring-Generator-TestConfig]/Exec[make-Monitoring-Generator-TestConfig]/returns: executed successfully
|
||||
==> default: Notice: /Stage[main]/Icinga2/Icinga2::Feature[compatlog]/Parent_dirs[/etc/icinga2/features-enabled/compatlog.conf]/Exec[parent_dirs-/etc/icinga2/features-enabled/compatlog.conf]/returns: executed successfully
|
||||
==> default: Notice: /Stage[main]/Icinga2_mysql/Icinga2::Feature[ido-mysql]/Parent_dirs[/etc/icinga2/features-enabled/ido-mysql.conf]/Exec[parent_dirs-/etc/icinga2/features-enabled/ido-mysql.conf]/returns: executed successfully
|
||||
==> default: Notice: /Stage[main]/Apache/Service[httpd]: Triggered 'refresh' from 1 events
|
||||
==> default: Notice: /Stage[main]/Icingaweb2_dev/Exec[enable-monitoring-module]/returns: executed successfully
|
||||
==> default: Notice: /Stage[main]/Icingaweb2_dev/Exec[enable-test-module]/returns: executed successfully
|
||||
==> default: Notice: /Stage[main]/Icinga2_mysql/Icinga2::Feature[ido-mysql]/Icinga2::Config[features-available/ido-mysql]/Parent_dirs[/etc/icinga2/features-available/ido-mysql.conf]/Exec[parent_dirs-/etc/icinga2/features-available/ido-mysql.conf]/returns: executed successfully
|
||||
==> default: Notice: /Stage[main]/Icinga2_pgsql/Icinga2::Feature[ido-pgsql]/Icinga2::Config[features-available/ido-pgsql]/Parent_dirs[/etc/icinga2/features-available/ido-pgsql.conf]/Exec[parent_dirs-/etc/icinga2/features-available/ido-pgsql.conf]/returns: executed successfully
|
||||
==> default: Notice: /Stage[main]/Icinga2_pgsql/Icinga2::Feature[ido-pgsql]/Parent_dirs[/etc/icinga2/features-enabled/ido-pgsql.conf]/Exec[parent_dirs-/etc/icinga2/features-enabled/ido-pgsql.conf]/returns: executed successfully
|
||||
|
||||
Fix provisioning for CentOS 7
|
|
@ -0,0 +1,7 @@
|
|||
---
|
||||
icingaweb2::config: /etc/icingaweb
|
||||
icingaweb2::log: /var/log/icingaweb/icingaweb.log
|
||||
icingaweb2::web_path: icingaweb
|
||||
icingaweb2::db_user: icingaweb
|
||||
icingaweb2::db_pass: icingaweb
|
||||
icingaweb2::db_name: icingaweb
|
|
@ -0,0 +1,9 @@
|
|||
---
|
||||
:backends:
|
||||
- yaml
|
||||
|
||||
:hierarchy:
|
||||
- common
|
||||
|
||||
:yaml:
|
||||
:datadir: /vagrant/.puppet/hiera
|
|
@ -0,0 +1,26 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
if which puppet >/dev/null 2>&1; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
RELEASEVER=$(rpm -q --qf "%{VERSION}" $(rpm -q --whatprovides redhat-release))
|
||||
|
||||
case $RELEASEVER in
|
||||
6|7)
|
||||
PUPPET="http://yum.puppetlabs.com/puppetlabs-release-el-${RELEASEVER}.noarch.rpm"
|
||||
;;
|
||||
*)
|
||||
echo "Unknown release version: $RELEASEVER" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
echo "Adding puppet repository.."
|
||||
rpm --import "https://yum.puppetlabs.com/RPM-GPG-KEY-puppetlabs"
|
||||
rpm -ivh $PUPPET >/dev/null
|
||||
|
||||
echo "Installing puppet.."
|
||||
yum install -y puppet >/dev/null
|
|
@ -0,0 +1,15 @@
|
|||
stage { 'repositories':
|
||||
before => Stage['main'],
|
||||
}
|
||||
|
||||
node default {
|
||||
class { 'epel':
|
||||
stage => repositories,
|
||||
}
|
||||
include icinga2_dev
|
||||
include icingaweb2_dev
|
||||
include motd
|
||||
file { '/etc/profile.d/env.sh':
|
||||
source => 'puppet:////vagrant/.puppet/files/etc/profile.d/env.sh'
|
||||
}
|
||||
}
|
|
@ -13,20 +13,31 @@
|
|||
# include apache
|
||||
#
|
||||
class apache {
|
||||
|
||||
$apache = $::operatingsystem ? {
|
||||
/(Debian|Ubuntu)/ => 'apache2',
|
||||
/(RedHat|CentOS|Fedora)/ => 'httpd'
|
||||
}
|
||||
|
||||
$user = $::operatingsystem ? {
|
||||
/(Debian|Ubuntu)/ => 'www-data',
|
||||
/(RedHat|CentOS|Fedora)/ => 'apache'
|
||||
}
|
||||
|
||||
package { $apache:
|
||||
ensure => installed,
|
||||
alias => 'apache'
|
||||
ensure => latest,
|
||||
alias => 'apache',
|
||||
}
|
||||
|
||||
service { $apache:
|
||||
ensure => running,
|
||||
enable => true,
|
||||
alias => 'apache',
|
||||
require => Package['apache']
|
||||
require => Package['apache'],
|
||||
}
|
||||
|
||||
@user { $user:
|
||||
alias => 'apache',
|
||||
}
|
||||
|
||||
User <| alias == apache |>
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
define cmmi_dir (
|
||||
$configure='./configure',
|
||||
$make='make && make install'
|
||||
) {
|
||||
Exec {
|
||||
path => '/usr/bin:/bin',
|
||||
cwd => "/usr/local/src/${name}",
|
||||
}
|
||||
|
||||
exec { "configure-${name}":
|
||||
command => $configure,
|
||||
} -> exec { "make-${name}":
|
||||
command => $make,
|
||||
}
|
||||
}
|
|
@ -16,7 +16,7 @@ class epel {
|
|||
|
||||
yumrepo { 'epel':
|
||||
mirrorlist => "http://mirrors.fedoraproject.org/mirrorlist?repo=epel-6&arch=${::architecture}",
|
||||
enabled => '0',
|
||||
enabled => '1',
|
||||
gpgcheck => '0',
|
||||
descr => "Extra Packages for Enterprise Linux 6 - ${::architecture}"
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
# Class: git
|
||||
#
|
||||
# This class installs git.
|
||||
#
|
||||
# Sample Usage:
|
||||
#
|
||||
# include git
|
||||
#
|
||||
class git {
|
||||
package { 'git':
|
||||
ensure => latest,
|
||||
}
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
define git_cmmi (
|
||||
$url,
|
||||
$configure='./configure',
|
||||
$make='make && make install'
|
||||
) {
|
||||
include git
|
||||
|
||||
$srcDir = '/usr/local/src'
|
||||
|
||||
exec { "git-clone-${name}":
|
||||
cwd => $srcDir,
|
||||
path => '/usr/bin:/bin',
|
||||
unless => "test -d '${srcDir}/${name}/.git'",
|
||||
command => "git clone '${url}' '${name}'",
|
||||
require => Class['git'],
|
||||
} -> cmmi_dir { $name:
|
||||
configure => $configure,
|
||||
make => $make,
|
||||
}
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
# Define: icinga2::config
|
||||
#
|
||||
# Provide Icinga 2 configuration file
|
||||
#
|
||||
# Parameters:
|
||||
#
|
||||
# [*source*] - where to take the file from
|
||||
#
|
||||
# Requires:
|
||||
#
|
||||
# icinga2
|
||||
#
|
||||
# Sample Usage:
|
||||
#
|
||||
# icinga2::config { 'constants';
|
||||
# source => 'puppet:///modules/icinga2_dev',
|
||||
# }
|
||||
#
|
||||
# Provide configuration file '/etc/icinga2/constants.conf'
|
||||
# from 'puppet:///modules/icinga2_dev/constants.conf'
|
||||
# ('/path/to/puppet/modules/icinga2_dev/files/constants.conf')
|
||||
#
|
||||
define icinga2::config ($source) {
|
||||
include icinga2
|
||||
|
||||
$path = "/etc/icinga2/${name}.conf"
|
||||
|
||||
parent_dirs { $path:
|
||||
user => 'icinga',
|
||||
require => [
|
||||
User['icinga'],
|
||||
File['icinga2cfgDir']
|
||||
],
|
||||
}
|
||||
-> file { $path:
|
||||
source => "${source}/${name}.conf",
|
||||
owner => 'icinga',
|
||||
group => 'icinga',
|
||||
notify => Service['icinga2'],
|
||||
require => User['icinga'],
|
||||
}
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
# Define: icinga2::feature
|
||||
#
|
||||
# Enable Icinga 2 feature
|
||||
#
|
||||
# Requires:
|
||||
#
|
||||
# icinga2
|
||||
#
|
||||
# Sample Usage:
|
||||
#
|
||||
# icinga2::feature { 'example-feature'; }
|
||||
#
|
||||
define icinga2::feature ($source = undef) {
|
||||
include icinga2
|
||||
|
||||
$target = "features-available/${name}"
|
||||
$cfgpath = '/etc/icinga2'
|
||||
$path = "${cfgpath}/features-enabled/${name}.conf"
|
||||
|
||||
if $source != undef {
|
||||
icinga2::config { $target:
|
||||
source => $source,
|
||||
}
|
||||
}
|
||||
|
||||
parent_dirs { $path:
|
||||
user => 'icinga',
|
||||
require => [
|
||||
User['icinga'],
|
||||
File['icinga2cfgDir']
|
||||
],
|
||||
}
|
||||
-> file { $path:
|
||||
ensure => link,
|
||||
target => "${cfgpath}/${target}.conf",
|
||||
notify => Service['icinga2'],
|
||||
}
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
# Class: icinga2
|
||||
#
|
||||
# This class installs Icinga 2.
|
||||
#
|
||||
# Requires:
|
||||
#
|
||||
# icinga_packages
|
||||
# icinga2::feature
|
||||
#
|
||||
# Sample Usage:
|
||||
#
|
||||
# include icinga2
|
||||
#
|
||||
class icinga2 {
|
||||
include icinga_packages
|
||||
|
||||
package { [
|
||||
'icinga2', 'icinga2-doc', 'icinga2-debuginfo'
|
||||
]:
|
||||
ensure => latest,
|
||||
require => Class['icinga_packages'],
|
||||
}
|
||||
-> service { 'icinga2':
|
||||
ensure => running,
|
||||
enable => true,
|
||||
require => User['icinga'],
|
||||
}
|
||||
|
||||
user { 'icinga':
|
||||
ensure => present,
|
||||
}
|
||||
-> file { 'icinga2cfgDir':
|
||||
path => '/etc/icinga2',
|
||||
ensure => directory,
|
||||
links => follow,
|
||||
owner => 'icinga',
|
||||
group => 'icinga',
|
||||
mode => 6750,
|
||||
}
|
||||
|
||||
icinga2::feature { [ 'statusdata', 'command', 'compatlog' ]: }
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
# Class: icinga2_mysql
|
||||
#
|
||||
# This class installs Icinga 2 and Icinga-2-IDO-MySQL and set up the database for the last one.
|
||||
#
|
||||
# Requires:
|
||||
#
|
||||
# icinga_packages
|
||||
# icinga2
|
||||
# icinga2::feature
|
||||
# icinga2::config
|
||||
# mysql::database::populate
|
||||
#
|
||||
# Sample Usage:
|
||||
#
|
||||
# include icinga2_mysql
|
||||
#
|
||||
class icinga2_mysql {
|
||||
include icinga2
|
||||
include icinga_packages
|
||||
|
||||
package { 'icinga2-ido-mysql':
|
||||
ensure => latest,
|
||||
require => Class['icinga_packages'],
|
||||
}
|
||||
-> mysql::database::populate { 'icinga2':
|
||||
username => 'icinga2',
|
||||
password => 'icinga2',
|
||||
privileges => 'SELECT,INSERT,UPDATE,DELETE',
|
||||
schemafile => '/usr/share/icinga2-ido-mysql/schema/mysql.sql',
|
||||
}
|
||||
-> icinga2::feature { 'ido-mysql':
|
||||
source => 'puppet:///modules/icinga2_mysql',
|
||||
}
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
class icinga2_pgsql {
|
||||
include icinga2
|
||||
include icinga_packages
|
||||
|
||||
package { 'icinga2-ido-pgsql':
|
||||
ensure => latest,
|
||||
require => Class['icinga_packages'],
|
||||
}
|
||||
-> pgsql::database::populate { 'icinga2':
|
||||
username => 'icinga2',
|
||||
password => 'icinga2',
|
||||
schemafile => '/usr/share/icinga2-ido-pgsql/schema/pgsql.sql',
|
||||
}
|
||||
-> icinga2::feature { 'ido-pgsql':
|
||||
source => 'puppet:///modules/icinga2_pgsql',
|
||||
}
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
# Class: icinga_packages
|
||||
#
|
||||
# This class adds the YUM repository for the Icinga packages.
|
||||
#
|
||||
# Sample Usage:
|
||||
#
|
||||
# include icinga_packages
|
||||
#
|
||||
class icinga_packages {
|
||||
yumrepo { 'icinga_packages':
|
||||
baseurl => 'http://packages.icinga.org/epel/6/snapshot/',
|
||||
enabled => '1',
|
||||
gpgcheck => '1',
|
||||
gpgkey => 'http://packages.icinga.org/icinga.key',
|
||||
descr => "Icinga Repository - ${::architecture}"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
class icingacli {
|
||||
file { '/usr/local/bin/icingacli':
|
||||
ensure => link,
|
||||
target => '/vagrant/bin/icingacli',
|
||||
}
|
||||
|
||||
file { '/etc/bash_completion.d/icingacli':
|
||||
ensure => link,
|
||||
target => '/vagrant/etc/bash_completion.d/icingacli',
|
||||
}
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
class icingaweb2::config (
|
||||
$config = hiera('icingaweb2::config')
|
||||
) {
|
||||
group { 'icingaweb':
|
||||
ensure => present,
|
||||
}
|
||||
|
||||
file { [ "${config}", "${config}/enabledModules", "${config}/modules", "${config}/preferences" ]:
|
||||
ensure => directory,
|
||||
owner => 'root',
|
||||
group => 'icingaweb',
|
||||
mode => '2770',
|
||||
}
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
define icingaweb2::config::general (
|
||||
$source,
|
||||
$config = hiera('icingaweb2::config'),
|
||||
$replace = true
|
||||
) {
|
||||
include icingaweb2::config
|
||||
|
||||
file { "${config}/${name}.ini":
|
||||
content => template("${source}/${name}.ini.erb"),
|
||||
owner => 'root',
|
||||
group => 'icingaweb',
|
||||
mode => 0660,
|
||||
replace => $replace,
|
||||
}
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
define icingaweb2::config::module (
|
||||
$module,
|
||||
$source,
|
||||
$config = hiera('icingaweb2::config'),
|
||||
$replace = true
|
||||
) {
|
||||
include icingaweb2::config
|
||||
|
||||
if ! defined(File["${config}/modules/${module}"]) {
|
||||
file { "${config}/modules/${module}":
|
||||
ensure => directory,
|
||||
owner => 'root',
|
||||
group => 'icingaweb',
|
||||
mode => '2770',
|
||||
}
|
||||
}
|
||||
|
||||
file { "${config}/modules/${module}/${name}.ini":
|
||||
source => "${source}/modules/${module}/${name}.ini",
|
||||
owner => 'root',
|
||||
group => 'icingaweb',
|
||||
mode => 0660,
|
||||
replace => $replace,
|
||||
}
|
||||
}
|
|
@ -1,9 +1,9 @@
|
|||
class monitoring-plugins {
|
||||
class monitoring_plugins {
|
||||
include epel
|
||||
|
||||
# nagios plugins from epel
|
||||
package { 'nagios-plugins-all':
|
||||
ensure => installed,
|
||||
ensure => latest,
|
||||
require => Class['epel']
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
class monitoring_test_config {
|
||||
package { [
|
||||
'perl',
|
||||
'perl-Module-Install',
|
||||
'perl-CPAN',
|
||||
'perl-File-Which',
|
||||
'perl-Time-HiRes'
|
||||
]:
|
||||
ensure => latest,
|
||||
}
|
||||
-> git_cmmi { 'Monitoring-Generator-TestConfig':
|
||||
url => 'https://github.com/sni/Monitoring-Generator-TestConfig.git',
|
||||
configure => 'perl Makefile.PL',
|
||||
make => 'make && make test && make install',
|
||||
}
|
||||
-> exec { 'create_monitoring_test_config':
|
||||
path => '/usr/local/bin:/usr/bin:/bin',
|
||||
command => 'install -o root -g root -d /usr/local/share/misc/ && \
|
||||
create_monitoring_test_config.pl -l icinga /usr/local/share/misc/monitoring_test_config',
|
||||
creates => '/usr/local/share/misc/monitoring_test_config',
|
||||
}
|
||||
-> monitoring_test_config::populate_plugins { [
|
||||
'test_hostcheck.pl', 'test_servicecheck.pl'
|
||||
]: }
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
define monitoring_test_config::populate_plugins {
|
||||
include icinga2
|
||||
include monitoring_plugins
|
||||
include monitoring_test_config
|
||||
|
||||
file { "/usr/lib64/nagios/plugins/${name}":
|
||||
owner => 'icinga',
|
||||
group => 'icinga',
|
||||
source => "/usr/local/share/misc/monitoring_test_config/plugins/${name}",
|
||||
require => [
|
||||
User['icinga'],
|
||||
Exec['create_monitoring_test_config'],
|
||||
Class['monitoring_plugins']
|
||||
],
|
||||
notify => Service['icinga2'],
|
||||
}
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
88 88
|
||||
88 ""
|
||||
88
|
||||
88 ,adPPYba, 88 8b,dPPYba, ,adPPYb,d8 ,adPPYYba,
|
||||
88 a8" "" 88 88P' `"8a a8" `Y88 "" `Y8
|
||||
88 8b 88 88 88 8b 88 ,adPPPPP88
|
||||
88 "8a, ,aa 88 88 88 "8a, ,d88 88, ,88
|
||||
88 `"Ybbd8"' 88 88 88 `"YbbdP"Y8 `"8bbdP"Y8
|
||||
aa, ,88
|
||||
"Y8bbdP"
|
||||
|
||||
I8, 8 ,8I 88 ad888888b,
|
||||
`8b d8b d8' 88 d8" "88
|
||||
"8, ,8"8, ,8" 88 a8P
|
||||
Y8 8P Y8 8P ,adPPYba, 88,dPPYba, ,d8P"
|
||||
`8b d8' `8b d8' a8P_____88 88P' "8a a8P"
|
||||
`8a a8' `8a a8' 8PP""""""" 88 d8 a8P'
|
||||
`8a8' `8a8' "8b, ,aa 88b, ,a8" d8"
|
||||
`8' `8' `"Ybbd8"' 8Y"Ybbd8"' 88888888888
|
|
@ -0,0 +1,7 @@
|
|||
class motd {
|
||||
file { '/etc/motd':
|
||||
source => 'puppet:///modules/motd/motd',
|
||||
owner => root,
|
||||
group => root,
|
||||
}
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
# Define: mysql::database::create
|
||||
#
|
||||
# Create a MySQL database
|
||||
#
|
||||
# Parameters:
|
||||
#
|
||||
# [*username*] - name of the user the database belongs to
|
||||
# [*password*] - password of the user the database belongs to
|
||||
# [*privileges*] - privileges of the user the database belongs to
|
||||
#
|
||||
# Requires:
|
||||
#
|
||||
# mysql
|
||||
#
|
||||
# Sample Usage:
|
||||
#
|
||||
# mysql::database::create { 'icinga2':
|
||||
# username => 'icinga2',
|
||||
# password => 'icinga2',
|
||||
# privileges => 'SELECT,INSERT,UPDATE,DELETE',
|
||||
# }
|
||||
#
|
||||
define mysql::database::create ($username, $password, $privileges) {
|
||||
include mysql
|
||||
|
||||
exec { "create-mysql-${name}-db":
|
||||
unless => "mysql -u${username} -p${password} ${name}",
|
||||
command => "mysql -uroot -e \"CREATE DATABASE ${name}; \
|
||||
GRANT ${privileges} ON ${name}.* TO ${username}@localhost \
|
||||
IDENTIFIED BY '${password}';\"",
|
||||
require => Class['mysql']
|
||||
}
|
||||
}
|
|
@ -0,0 +1,39 @@
|
|||
# Define: mysql::database::populate
|
||||
#
|
||||
# Create and populate a MySQL database
|
||||
#
|
||||
# Parameters:
|
||||
#
|
||||
# [*username*] - name of the user the database belongs to
|
||||
# [*password*] - password of the user the database belongs to
|
||||
# [*privileges*] - privileges of the user the database belongs to
|
||||
# [*schemafile*] - file with the schema for the database
|
||||
#
|
||||
# Requires:
|
||||
#
|
||||
# mysql::database::create
|
||||
#
|
||||
# Sample Usage:
|
||||
#
|
||||
# mysql::database::populate { 'icinga2':
|
||||
# username => 'icinga2',
|
||||
# password => 'icinga2',
|
||||
# privileges => 'SELECT,INSERT,UPDATE,DELETE',
|
||||
# schemafile => '/usr/share/icinga2-ido-mysql/schema/mysql.sql',
|
||||
# }
|
||||
#
|
||||
define mysql::database::populate ($username, $password, $privileges, $schemafile) {
|
||||
Exec { path => '/bin:/usr/bin' }
|
||||
|
||||
mysql::database::create { $name:
|
||||
username => $username,
|
||||
password => $password,
|
||||
privileges => $privileges,
|
||||
}
|
||||
|
||||
exec { "populate-${name}-mysql-db":
|
||||
onlyif => "mysql -u${username} -p${password} ${name} -e \"SELECT COUNT(*) FROM information_schema.tables WHERE table_schema = '${name}';\" 2>/dev/null |grep -qEe '^ *0 *$'",
|
||||
command => "mysql -uroot ${name} < ${schemafile}",
|
||||
require => Mysql::Database::Create[$name],
|
||||
}
|
||||
}
|
|
@ -16,15 +16,15 @@ class mysql {
|
|||
|
||||
Exec { path => '/usr/bin' }
|
||||
|
||||
package {
|
||||
'mysql':
|
||||
ensure => installed;
|
||||
'mysql-server':
|
||||
ensure => installed;
|
||||
package { [
|
||||
'mysql', 'mysql-server'
|
||||
]:
|
||||
ensure => latest,
|
||||
}
|
||||
|
||||
service { 'mysqld':
|
||||
ensure => running,
|
||||
enable => true,
|
||||
require => Package['mysql-server']
|
||||
}
|
||||
|
|
@ -14,8 +14,8 @@
|
|||
#
|
||||
class openldap {
|
||||
|
||||
package { ['openldap-servers', 'openldap-clients']:
|
||||
ensure => installed
|
||||
package { ['openldap-servers', 'openldap-clients']:
|
||||
ensure => latest,
|
||||
}
|
||||
|
||||
service { 'slapd':
|
|
@ -0,0 +1,8 @@
|
|||
# TODO(el): Remove this. It's always executed and hackish
|
||||
define parent_dirs ($user = 'root') {
|
||||
exec { "parent_dirs-${name}":
|
||||
command => "mkdir -p \"\$(dirname \"\$(readlink -m '${name}')\")\"",
|
||||
path => '/bin:/usr/bin',
|
||||
user => $user,
|
||||
}
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
# Define: pgsql::database::create
|
||||
#
|
||||
# Create a PgSQL database
|
||||
#
|
||||
# Parameters:
|
||||
#
|
||||
# [*username*] - name of the user the database belongs to
|
||||
# [*password*] - password of the user the database belongs to
|
||||
#
|
||||
# Requires:
|
||||
#
|
||||
# pgsql
|
||||
#
|
||||
# Sample Usage:
|
||||
#
|
||||
# pgsql::database::create { 'icinga2':
|
||||
# username => 'icinga2',
|
||||
# password => 'icinga2',
|
||||
# }
|
||||
#
|
||||
define pgsql::database::create ($username, $password) {
|
||||
include pgsql
|
||||
|
||||
exec { "create-pgsql-${name}-db":
|
||||
unless => "psql -tAc \"SELECT 1 FROM pg_roles WHERE rolname='${username}'\" | grep -q 1",
|
||||
command => "psql -c \"CREATE ROLE ${username} WITH LOGIN PASSWORD '${password}';\" && \
|
||||
createdb -O ${username} -E UTF8 -T template0 ${name} && \
|
||||
createlang plpgsql ${name}",
|
||||
user => 'postgres',
|
||||
require => Class['pgsql']
|
||||
}
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
# Define: pgsql::database::populate
|
||||
#
|
||||
# Create and populate a PgSQL database
|
||||
#
|
||||
# Parameters:
|
||||
#
|
||||
# [*username*] - name of the user the database belongs to
|
||||
# [*password*] - password of the user the database belongs to
|
||||
# [*schemafile*] - file with the schema for the database
|
||||
#
|
||||
# Requires:
|
||||
#
|
||||
# pgsql::database::create
|
||||
#
|
||||
# Sample Usage:
|
||||
#
|
||||
# pgsql::database::populate { 'icinga2':
|
||||
# username => 'icinga2',
|
||||
# password => 'icinga2',
|
||||
# schemafile => '/usr/share/icinga2-ido-pgsql/schema/pgsql.sql',
|
||||
# }
|
||||
#
|
||||
define pgsql::database::populate ($username, $password, $schemafile) {
|
||||
Exec { path => '/bin:/usr/bin' }
|
||||
|
||||
pgsql::database::create { $name:
|
||||
username => $username,
|
||||
password => $password,
|
||||
}
|
||||
|
||||
exec { "populate-${name}-pgsql-db":
|
||||
onlyif => "psql -U ${username} -d ${name} -c \"SELECT COUNT(*) FROM information_schema.tables WHERE table_schema = '${name}';\" 2>/dev/null |grep -qEe '^ *0 *$'",
|
||||
command => "psql -U ${username} -d ${name} < ${schemafile}",
|
||||
user => 'postgres',
|
||||
require => Pgsql::Database::Create[$name],
|
||||
}
|
||||
}
|
|
@ -17,11 +17,10 @@ class pgsql {
|
|||
|
||||
Exec { path => '/sbin:/bin:/usr/bin' }
|
||||
|
||||
package {
|
||||
'postgresql':
|
||||
ensure => installed;
|
||||
'postgresql-server':
|
||||
ensure => installed;
|
||||
package { [
|
||||
'postgresql', 'postgresql-server'
|
||||
]:
|
||||
ensure => latest,
|
||||
}
|
||||
|
||||
exec { 'initdb':
|
|
@ -19,10 +19,15 @@ class php {
|
|||
include apache
|
||||
|
||||
package { 'php':
|
||||
ensure => installed,
|
||||
ensure => latest,
|
||||
require => Package['apache'],
|
||||
notify => Service['apache']
|
||||
}
|
||||
# TODO(el): Always executed. Should be a resource
|
||||
-> exec { 'php-timezone':
|
||||
command => 'sed -re $\'s#^;?(date\\.timezone =).*$#\\1 "UTC"#\' -i /etc/php.ini',
|
||||
notify => Service['apache'],
|
||||
}
|
||||
|
||||
file { '/etc/php.d/error_reporting.ini':
|
||||
content => template('php/error_reporting.ini.erb'),
|
|
@ -0,0 +1,24 @@
|
|||
# Class: zend_framework
|
||||
#
|
||||
# This class installs the Zend Framework.
|
||||
#
|
||||
# Requires:
|
||||
#
|
||||
# epel
|
||||
#
|
||||
# Sample Usage:
|
||||
#
|
||||
# include zend_framework
|
||||
#
|
||||
class zend_framework {
|
||||
include epel
|
||||
|
||||
package { [
|
||||
'php-ZendFramework',
|
||||
'php-ZendFramework-Db-Adapter-Pdo-Mysql',
|
||||
'php-ZendFramework-Db-Adapter-Pdo-Pgsql'
|
||||
]:
|
||||
ensure => latest,
|
||||
require => Class['epel'],
|
||||
}
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
# Class: icinga2_dev
|
||||
#
|
||||
# This class installs Icinga 2 w/ MySQL and provides Icinga 2 test configuration.
|
||||
#
|
||||
# Requires:
|
||||
#
|
||||
# icinga2_mysql
|
||||
# icinga2::config
|
||||
#
|
||||
# Sample Usage:
|
||||
#
|
||||
# include icinga2_dev
|
||||
#
|
||||
class icinga2_dev {
|
||||
include icinga2_mysql
|
||||
include icinga2_pgsql
|
||||
include monitoring_plugins
|
||||
include monitoring_test_config
|
||||
|
||||
icinga2::config { [
|
||||
'conf.d/test-config', 'conf.d/commands', 'constants' ]:
|
||||
source => 'puppet:///modules/icinga2_dev',
|
||||
}
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
[ido-mysql]
|
||||
type = ido
|
||||
resource = ido-mysql
|
||||
|
||||
[ido-pgsql]
|
||||
type = ido
|
||||
resource = ido-pgsql
|
||||
|
||||
[livestatus]
|
||||
disabled = 1
|
||||
type = livestatus
|
||||
resource = livestatus
|
|
@ -0,0 +1,2 @@
|
|||
[security]
|
||||
protected_customvars = "*pw*,*pass*,community"
|
|
@ -0,0 +1,2 @@
|
|||
[icinga]
|
||||
path = "/var/run/icinga2/cmd/icinga2.cmd"
|
|
@ -0,0 +1,140 @@
|
|||
class icingaweb2_dev (
|
||||
$config = hiera('icingaweb2::config'),
|
||||
$log = hiera('icingaweb2::log'),
|
||||
$web_path = hiera('icingaweb2::web_path'),
|
||||
$db_user = hiera('icingaweb2::db_user'),
|
||||
$db_pass = hiera('icingaweb2::db_pass'),
|
||||
$db_name = hiera('icingaweb2::db_name'),
|
||||
) {
|
||||
include apache
|
||||
include php
|
||||
include icingaweb2::config
|
||||
include icingacli
|
||||
include icinga_packages
|
||||
include openldap
|
||||
|
||||
# TODO(el): Only include zend_framework. Apache does not have to be notified
|
||||
class { 'zend_framework':
|
||||
notify => Service['apache'],
|
||||
}
|
||||
|
||||
# TODO(el): icinga-gui is not a icingaweb2_dev package
|
||||
package { [ 'php-pdo', 'php-ldap', 'php-phpunit-PHPUnit', 'icinga-gui' ]:
|
||||
ensure => latest,
|
||||
notify => Service['apache'],
|
||||
require => Class['icinga_packages'],
|
||||
}
|
||||
|
||||
Exec { path => '/usr/local/bin:/usr/bin:/bin' }
|
||||
|
||||
# TODO(el): Enabling/disabling modules should be a resource
|
||||
User <| alias == apache |> { groups +> 'icingaweb' }
|
||||
-> exec { 'enable-monitoring-module':
|
||||
command => 'icingacli module enable monitoring',
|
||||
user => 'apache',
|
||||
require => Class[[ 'icingacli', 'apache' ]],
|
||||
}
|
||||
-> exec { 'enable-test-module':
|
||||
command => 'icingacli module enable test',
|
||||
user => 'apache'
|
||||
}
|
||||
|
||||
# TODO(el): 'icingacmd' is NOT a icingaweb2_dev group
|
||||
group { 'icingacmd':
|
||||
ensure => present,
|
||||
}
|
||||
|
||||
User <| alias == apache |> { groups +> 'icingacmd' }
|
||||
|
||||
$log_dir = inline_template('<%= File.dirname(@log) %>')
|
||||
file { $log_dir:
|
||||
ensure => directory,
|
||||
owner => 'root',
|
||||
group => 'icingaweb',
|
||||
mode => '2775'
|
||||
}
|
||||
|
||||
$icingaadminSelect = "as CNT from icingaweb_user where name = \'icingaadmin\'\" |grep -qwe \'cnt=0\'"
|
||||
$icingaadminInsert = "\"INSERT INTO icingaweb_user (name, active, password_hash) VALUES (\'icingaadmin\', 1, \'\\\$1\\\$JMdnEc9M\\\$FW7yapAjv0atS43NkapGo/\');\""
|
||||
|
||||
mysql::database::populate { "${db_name}":
|
||||
username => "${db_user}",
|
||||
password => "${db_pass}",
|
||||
privileges => 'ALL',
|
||||
schemafile => '/vagrant/etc/schema/mysql.schema.sql',
|
||||
}
|
||||
-> exec { 'mysql-icingaadmin':
|
||||
onlyif => "mysql -u${db_user} -p${db_pass} ${db_name} -e \"select CONCAT(\'cnt=\', COUNT(name)) ${icingaadminSelect}",
|
||||
command => "mysql -u${db_user} -p${db_pass} ${db_name} -e ${icingaadminInsert}",
|
||||
}
|
||||
|
||||
pgsql::database::populate { "${db_name}":
|
||||
username => "${db_user}",
|
||||
password => "${db_pass}",
|
||||
schemafile => '/vagrant/etc/schema/pgsql.schema.sql',
|
||||
}
|
||||
-> exec { 'pgsql-icingaadmin':
|
||||
onlyif => "psql -U ${db_user} -w -d ${db_name} -c \"select 'cnt=' || COUNT(name) ${icingaadminSelect}",
|
||||
command => "psql -U ${db_user} -w -d ${db_name} -c ${icingaadminInsert}",
|
||||
environment => "PGPASSWORD=${db_pass}",
|
||||
}
|
||||
|
||||
file { '/etc/httpd/conf.d/icingaweb.conf':
|
||||
content => template("$name/icingaweb.conf.erb"),
|
||||
notify => Service['apache'],
|
||||
}
|
||||
|
||||
icingaweb2::config::general { 'authentication':
|
||||
source => $name,
|
||||
}
|
||||
|
||||
icingaweb2::config::general { [ 'config', 'resources' ]:
|
||||
source => $name,
|
||||
replace => false,
|
||||
}
|
||||
|
||||
icingaweb2::config::module { [ 'backends', 'config', 'instances' ]:
|
||||
module => 'monitoring',
|
||||
source => 'puppet:///modules/icingaweb2_dev',
|
||||
}
|
||||
|
||||
# TODO(el): Should be a resource
|
||||
package { 'iptables':
|
||||
ensure => latest
|
||||
}
|
||||
-> exec { 'iptables-allow-http':
|
||||
unless => 'grep -qe "-A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT" /etc/sysconfig/iptables',
|
||||
command => '/sbin/iptables -I INPUT 1 -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT && /sbin/iptables-save > /etc/sysconfig/iptables'
|
||||
}
|
||||
|
||||
# TODO(el): Don't define inside a class
|
||||
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(el): 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'
|
||||
]]
|
||||
],
|
||||
}
|
||||
|
||||
# TODO(el): Should be a module
|
||||
package { 'php-deepend-Mockery':
|
||||
ensure => latest,
|
||||
}
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
[autologin]
|
||||
backend = autologin
|
||||
|
||||
[icingaweb-mysql]
|
||||
backend = db
|
||||
resource = icingaweb-mysql
|
||||
|
||||
[icingaweb-pgsql]
|
||||
backend = db
|
||||
resource = icingaweb-pgsql
|
||||
|
||||
[local-ldap]
|
||||
backend = ldap
|
||||
resource = local-ldap
|
||||
user_class = inetOrgPerson
|
||||
user_name_attribute = uid
|
|
@ -0,0 +1,7 @@
|
|||
[logging]
|
||||
log = "file"
|
||||
file = "<%= @log %>"
|
||||
level = DEBUG
|
||||
|
||||
[preferences]
|
||||
type = "ini"
|
|
@ -1,4 +1,4 @@
|
|||
Alias /icingaweb /vagrant/public
|
||||
Alias /<%= @web_path %> /vagrant/public
|
||||
|
||||
<Directory "/vagrant/public/">
|
||||
Options FollowSymLinks
|
||||
|
@ -6,12 +6,12 @@ Alias /icingaweb /vagrant/public
|
|||
Order allow,deny
|
||||
Allow from all
|
||||
|
||||
# SetEnv ICINGAWEB_CONFIGDIR /etc/icingaweb
|
||||
# SetEnv ICINGAWEB_CONFIGDIR <%= @config %>
|
||||
|
||||
EnableSendfile Off
|
||||
|
||||
RewriteEngine on
|
||||
RewriteBase /icingaweb/
|
||||
RewriteBase /<%= @web_path %>/
|
||||
RewriteCond %{REQUEST_FILENAME} -s [OR]
|
||||
RewriteCond %{REQUEST_FILENAME} -l [OR]
|
||||
RewriteCond %{REQUEST_FILENAME} -d
|
|
@ -0,0 +1,43 @@
|
|||
[icingaweb-mysql]
|
||||
type = db
|
||||
db = mysql
|
||||
host = localhost
|
||||
port = 3306
|
||||
username = <%= @db_user %>
|
||||
password = <%= @db_pass %>
|
||||
dbname = <%= @db_name %>
|
||||
|
||||
[icingaweb-pgsql]
|
||||
type = db
|
||||
db = pgsql
|
||||
host = localhost
|
||||
port = 5432
|
||||
username = <%= @db_user %>
|
||||
password = <%= @db_pass %>
|
||||
dbname = <%= @db_name %>
|
||||
|
||||
[ido-mysql]
|
||||
type = db
|
||||
db = mysql
|
||||
host = localhost
|
||||
port = 3306
|
||||
password = icinga2
|
||||
username = icinga2
|
||||
dbname = icinga2
|
||||
|
||||
[ido-pgsql]
|
||||
type = db
|
||||
db = pgsql
|
||||
host = localhost
|
||||
port = 5432
|
||||
password = icinga2
|
||||
username = icinga2
|
||||
dbname = icinga2
|
||||
|
||||
[local-ldap]
|
||||
type = ldap
|
||||
hostname = localhost
|
||||
port = 389
|
||||
root_dn = "ou=people,dc=icinga,dc=org"
|
||||
bind_dn = "cn=admin,cn=config"
|
||||
bind_pw = admin
|
|
@ -1,15 +0,0 @@
|
|||
[autologin]
|
||||
backend = autologin
|
||||
;
|
||||
; If you want to strip the domain
|
||||
; strip_username_regexp = /\@[^$]+$/
|
||||
|
||||
[internal_ldap_authentication]
|
||||
backend = ldap
|
||||
resource = internal_ldap
|
||||
user_class = inetOrgPerson
|
||||
user_name_attribute = uid
|
||||
|
||||
[internal_db_authentication]
|
||||
backend = db
|
||||
resource = internal_db
|
|
@ -1,19 +0,0 @@
|
|||
[localdb]
|
||||
|
||||
type = ido
|
||||
resource = "ido"
|
||||
|
||||
[locallive]
|
||||
disabled = "1"
|
||||
type = livestatus
|
||||
resource = livestatus
|
||||
|
||||
[localfile]
|
||||
disabled = "1"
|
||||
type = statusdat
|
||||
resource = statusdat
|
||||
|
||||
;[localfailsafe]
|
||||
;enabled=false
|
||||
;type = combo
|
||||
;backends = localdb, locallive, localfile
|
|
@ -1,2 +0,0 @@
|
|||
[icinga]
|
||||
path = "/var/run/icinga2/cmd/icinga2.cmd"
|
|
@ -1,34 +0,0 @@
|
|||
[internal_db]
|
||||
type = db
|
||||
db = mysql
|
||||
host = localhost
|
||||
port = 3306
|
||||
password = icingaweb
|
||||
username = icingaweb
|
||||
dbname = icingaweb
|
||||
|
||||
[ido]
|
||||
type = db
|
||||
db = mysql
|
||||
host = localhost
|
||||
port = 3306
|
||||
password = icinga2
|
||||
username = icinga2
|
||||
dbname = icinga2
|
||||
|
||||
[statusdat]
|
||||
type = statusdat
|
||||
status_file = /usr/local/icinga-mysql/var/status.dat
|
||||
object_file = /usr/local/icinga-mysql/var/objects.cache
|
||||
|
||||
[livestatus]
|
||||
type = livestatus
|
||||
socket = /usr/local/icinga-mysql/var/rw/live
|
||||
|
||||
[internal_ldap]
|
||||
type = ldap
|
||||
hostname = localhost
|
||||
port = 389
|
||||
root_dn = "ou=people, dc=icinga, dc=org"
|
||||
bind_dn = "cn=admin,cn=config"
|
||||
bind_pw = admin
|
|
@ -1,71 +0,0 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# chkconfig: 345 99 01
|
||||
#
|
||||
### BEGIN INIT INFO
|
||||
# Provides: icinga_command_proxy
|
||||
# Required-Start: $remote_fs $syslog
|
||||
# Required-Stop: $remote_fs $syslog
|
||||
# Should-Start: icinga
|
||||
# Should-Stop: icinga
|
||||
### END INIT INFO
|
||||
|
||||
# Source function library.
|
||||
. /etc/rc.d/init.d/functions
|
||||
|
||||
PROG="icinga_command_proxy"
|
||||
BIN="/usr/local/bin/icinga_command_proxy"
|
||||
|
||||
if [[ -f /etc/sysconfig/$PROG ]]; then
|
||||
. /etc/sysconfig/$PROG
|
||||
fi
|
||||
|
||||
ICINGA_CMD=${ICINGA_CMD:-"/usr/local/icinga/var/rw/icinga.cmd"}
|
||||
ICINGA_MYSQL_CMD=${ICINGA_MYSQL_CMD:-"/usr/local/icinga-mysql/var/rw/icinga.cmd"}
|
||||
ICINGA_PGSQL_CMD=${ICINGA_PGSQL_CMD:-"/usr/local/icinga-pgsql/var/rw/icinga.cmd"}
|
||||
|
||||
LOCKFILE=${LOCKFILE:-/var/lock/subsys/$PROG}
|
||||
PIDFILE=${PIDFILE:-/var/lock/subsys/$PROG/$PROG.pid}
|
||||
|
||||
RETVAL=0
|
||||
|
||||
start() {
|
||||
echo -n $"Starting $PROG: "
|
||||
daemon --pidfile="$PIDFILE" "nohup \"$BIN\" \"$ICINGA_CMD\" \"$ICINGA_MYSQL_CMD\" \"$ICINGA_PGSQL_CMD\" >/dev/null 2>&1 &"
|
||||
RETVAL=$?
|
||||
echo
|
||||
[ $RETVAL = 0 ] && touch "$LOCKFILE"
|
||||
return $RETVAL
|
||||
}
|
||||
|
||||
stop() {
|
||||
echo -n $"Stopping $PROG: "
|
||||
killproc -p "$PIDFILE" "$BIN"
|
||||
RETVAL=$?
|
||||
echo
|
||||
[ $RETVAL = 0 ] && rm -f "$LOCKFILE" "$PIDFILE"
|
||||
}
|
||||
|
||||
# See how we were called.
|
||||
case "$1" in
|
||||
start)
|
||||
start
|
||||
;;
|
||||
stop)
|
||||
stop
|
||||
;;
|
||||
status)
|
||||
status -p "$PIDFILE" "$BIN"
|
||||
RETVAL=$?
|
||||
;;
|
||||
restart)
|
||||
stop
|
||||
start
|
||||
;;
|
||||
*)
|
||||
echo $"Usage: $PROG {start|stop|restart|status}"
|
||||
RETVAL=2
|
||||
esac
|
||||
|
||||
exit $RETVAL
|
||||
|
|
@ -1,16 +0,0 @@
|
|||
______ ___
|
||||
/\__ _\ __ /'___`\
|
||||
\/_/\ \/ ___ /\_\ ___ __ __ /\_\ /\ \
|
||||
\ \ \ /'___\/\ \ /' _ `\ /'_ `\ /'__`\ \/_/// /__
|
||||
\_\ \__/\ \__/\ \ \/\ \/\ \/\ \L\ \/\ \L\.\_ // /_\ \
|
||||
/\_____\ \____\\ \_\ \_\ \_\ \____ \ \__/.\_\ /\______/
|
||||
\/_____/\/____/ \/_/\/_/\/_/\/___L\ \/__/\/_/ \/_____/
|
||||
/\____/
|
||||
\_/__/
|
||||
__ __ __
|
||||
/\ \ __/\ \ /\ \
|
||||
\ \ \/\ \ \ \ __\ \ \____
|
||||
\ \ \ \ \ \ \ /'__`\ \ '__`\
|
||||
\ \ \_/ \_\ \/\ __/\ \ \L\ \
|
||||
\ `\___x___/\ \____\\ \_,__/
|
||||
'\/__//__/ \/____/ \/___/
|
|
@ -1,42 +0,0 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# Redirect commands from pipe A to pipe B and C
|
||||
#
|
||||
|
||||
set -e
|
||||
set -u
|
||||
|
||||
ICINGA_CMD=${1:-"/usr/local/icinga/var/rw/icinga.cmd"}
|
||||
ICINGA_MYSQL_CMD=${2:-"/usr/local/icinga-mysql/var/rw/icinga.cmd"}
|
||||
ICINGA_PGSQL_CMD=${3:-"/usr/local/icinga-pgsql/var/rw/icinga.cmd"}
|
||||
|
||||
trap 'rm -f "$ICINGA_CMD"; exit' EXIT SIGKILL
|
||||
|
||||
if [[ -p "$ICINGA_CMD" ]]; then
|
||||
rm -f "$ICINGA_CMD"
|
||||
fi
|
||||
|
||||
mkfifo -m 660 "$ICINGA_CMD"
|
||||
chown icinga.icinga-cmd "$ICINGA_CMD"
|
||||
|
||||
while true
|
||||
do
|
||||
if read COMMAND
|
||||
then
|
||||
if [[ -p "$ICINGA_MYSQL_CMD" ]]; then
|
||||
echo "$COMMAND" > "$ICINGA_MYSQL_CMD"
|
||||
else
|
||||
logger -p local0.err Can\'t distribute command to the Icinga MySQL instance since its command pipe doesn\'t exist
|
||||
fi
|
||||
if [[ -p "$ICINGA_PGSQL_CMD" ]]; then
|
||||
echo "$COMMAND" > "$ICINGA_PGSQL_CMD"
|
||||
else
|
||||
logger -p local0.err Can\'t distribute command to the Icinga PostgreSQL instance since its command pipe doesn\'t exist
|
||||
fi
|
||||
fi
|
||||
done < "$ICINGA_CMD" 3> "$ICINGA_CMD"
|
||||
|
||||
# Reset all traps
|
||||
trap - EXIT SIGKILL
|
||||
|
||||
exit 0
|
|
@ -1,5 +0,0 @@
|
|||
<?php
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
|
||||
include '/vagrant/library/Icinga/Application/webrouter.php';
|
|
@ -1,763 +0,0 @@
|
|||
include apache
|
||||
include mysql
|
||||
include pgsql
|
||||
include openldap
|
||||
|
||||
Exec { path => '/bin:/usr/bin:/sbin:/usr/sbin' }
|
||||
|
||||
$icingaVersion = '1.11.5'
|
||||
$icinga2Version = '2.0.1'
|
||||
$pluginVersion = '2.0'
|
||||
$livestatusVersion = '1.2.4p5'
|
||||
$phantomjsVersion = '1.9.1'
|
||||
$casperjsVersion = '1.0.2'
|
||||
|
||||
exec { 'create-mysql-icinga-db':
|
||||
unless => 'mysql -uicinga -picinga icinga',
|
||||
command => 'mysql -uroot -e "CREATE DATABASE icinga; \
|
||||
GRANT SELECT,INSERT,UPDATE,DELETE ON icinga.* TO icinga@localhost \
|
||||
IDENTIFIED BY \'icinga\';"',
|
||||
require => Service['mysqld']
|
||||
}
|
||||
|
||||
exec { 'create-mysql-icinga2-db':
|
||||
unless => 'mysql -uicinga2 -picinga2 icinga2',
|
||||
command => 'mysql -uroot -e "CREATE DATABASE icinga2; \
|
||||
GRANT SELECT,INSERT,UPDATE,DELETE ON icinga2.* to icinga2@localhost \
|
||||
IDENTIFIED BY \'icinga2\';"',
|
||||
require => Service['mysqld']
|
||||
}
|
||||
|
||||
exec{ 'create-pgsql-icinga-db':
|
||||
unless => 'sudo -u postgres psql -tAc "SELECT 1 FROM pg_roles WHERE rolname=\'icinga\'" | grep -q 1',
|
||||
command => 'sudo -u postgres psql -c "CREATE ROLE icinga WITH LOGIN PASSWORD \'icingaweb\';" && \
|
||||
sudo -u postgres createdb -O icinga -E UTF8 -T template0 icinga && \
|
||||
sudo -u postgres createlang plpgsql icinga',
|
||||
require => Service['postgresql']
|
||||
}
|
||||
|
||||
$icinga_packages = [ 'gcc', 'glibc', 'glibc-common', 'gd', 'gd-devel',
|
||||
'libpng', 'libpng-devel', 'net-snmp', 'net-snmp-devel', 'net-snmp-utils',
|
||||
'libdbi', 'libdbi-devel', 'libdbi-drivers',
|
||||
'libdbi-dbd-mysql', 'libdbi-dbd-pgsql' ]
|
||||
package { $icinga_packages: ensure => installed }
|
||||
|
||||
php::extension { ['php-mysql', 'php-pgsql', 'php-ldap']:
|
||||
require => [ Class['mysql'], Class['pgsql'], Class['openldap'] ]
|
||||
}
|
||||
|
||||
php::extension { 'php-gd': }
|
||||
|
||||
group { 'icinga-cmd':
|
||||
ensure => present
|
||||
}
|
||||
|
||||
group { 'icingacmd':
|
||||
ensure => present,
|
||||
require => Package['icinga2']
|
||||
}
|
||||
|
||||
user { 'icinga':
|
||||
ensure => present,
|
||||
groups => 'icinga-cmd',
|
||||
managehome => false
|
||||
}
|
||||
|
||||
user { 'apache':
|
||||
groups => ['icinga-cmd', 'vagrant', 'icingacmd'],
|
||||
require => [ Class['apache'], Group['icinga-cmd'], Group['icingacmd'] ]
|
||||
}
|
||||
|
||||
cmmi { 'icinga-mysql':
|
||||
url => "https://github.com/Icinga/icinga-core/releases/download/v${icingaVersion}/icinga-${icingaVersion}.tar.gz",
|
||||
output => "icinga-${icingaVersion}.tar.gz",
|
||||
flags => '--prefix=/usr/local/icinga-mysql --with-command-group=icinga-cmd \
|
||||
--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',
|
||||
creates => '/usr/local/icinga-mysql',
|
||||
make => 'make all && make fullinstall install-config',
|
||||
require => [ User['icinga'], Class['monitoring-plugins'], Package['apache'] ],
|
||||
notify => Service['apache']
|
||||
}
|
||||
|
||||
file { '/etc/init.d/icinga-mysql':
|
||||
source => '/usr/local/icinga-mysql/etc/init.d/icinga',
|
||||
require => Cmmi['icinga-mysql']
|
||||
}
|
||||
|
||||
file { '/etc/init.d/ido2db-mysql':
|
||||
source => '/usr/local/icinga-mysql/etc/init.d/ido2db',
|
||||
require => Cmmi['icinga-mysql']
|
||||
}
|
||||
|
||||
cmmi { 'icinga-pgsql':
|
||||
url => "https://github.com/Icinga/icinga-core/releases/download/v${icingaVersion}/icinga-${icingaVersion}.tar.gz",
|
||||
output => "icinga-${icingaVersion}.tar.gz",
|
||||
flags => '--prefix=/usr/local/icinga-pgsql \
|
||||
--with-command-group=icinga-cmd --enable-idoutils \
|
||||
--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',
|
||||
creates => '/usr/local/icinga-pgsql',
|
||||
make => 'make all && make fullinstall install-config',
|
||||
require => [ User['icinga'], Class['monitoring-plugins'], Package['apache'] ],
|
||||
notify => Service['apache']
|
||||
}
|
||||
|
||||
file { '/etc/init.d/icinga-pgsql':
|
||||
source => '/usr/local/icinga-pgsql/etc/init.d/icinga',
|
||||
require => Cmmi['icinga-pgsql']
|
||||
}
|
||||
|
||||
file { '/etc/init.d/ido2db-pgsql':
|
||||
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 -uroot icinga < /usr/local/src/icinga-mysql/icinga-${icingaVersion}/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-${icingaVersion}/module/idoutils/db/pgsql/pgsql.sql",
|
||||
require => [ Cmmi['icinga-pgsql'], Exec['create-pgsql-icinga-db'] ]
|
||||
}
|
||||
|
||||
service { 'icinga-mysql':
|
||||
ensure => running,
|
||||
require => File['/etc/init.d/icinga-mysql']
|
||||
}
|
||||
|
||||
service { 'ido2db-mysql':
|
||||
ensure => running,
|
||||
require => File['/etc/init.d/ido2db-mysql']
|
||||
}
|
||||
|
||||
file { '/usr/local/icinga-mysql/etc/ido2db.cfg':
|
||||
content => template('icinga/ido2db-mysql.cfg.erb'),
|
||||
owner => 'icinga',
|
||||
group => 'icinga',
|
||||
require => Cmmi['icinga-mysql'],
|
||||
notify => [ Service['icinga-mysql'], Service['ido2db-mysql'] ]
|
||||
}
|
||||
|
||||
file { '/usr/local/icinga-mysql/etc/idomod.cfg':
|
||||
source => '/usr/local/icinga-mysql/etc/idomod.cfg-sample',
|
||||
owner => 'icinga',
|
||||
group => 'icinga',
|
||||
require => Cmmi['icinga-mysql'],
|
||||
notify => [ Service['icinga-mysql'], Service['ido2db-mysql'] ]
|
||||
}
|
||||
|
||||
file { '/usr/local/icinga-mysql/etc/modules/idoutils.cfg':
|
||||
source => '/usr/local/icinga-mysql/etc/modules/idoutils.cfg-sample',
|
||||
owner => 'icinga',
|
||||
group => 'icinga',
|
||||
require => Cmmi['icinga-mysql'],
|
||||
notify => [ Service['icinga-mysql'], Service['ido2db-mysql'] ]
|
||||
}
|
||||
|
||||
service { 'icinga-pgsql':
|
||||
ensure => running,
|
||||
require => Cmmi['icinga-pgsql']
|
||||
}
|
||||
|
||||
service { 'ido2db-pgsql':
|
||||
ensure => running,
|
||||
require => Cmmi['icinga-pgsql']
|
||||
}
|
||||
|
||||
file { '/usr/local/icinga-pgsql/etc/ido2db.cfg':
|
||||
content => template('icinga/ido2db-pgsql.cfg.erb'),
|
||||
owner => 'icinga',
|
||||
group => 'icinga',
|
||||
require => Cmmi['icinga-pgsql'],
|
||||
notify => [ Service['icinga-pgsql'], Service['ido2db-pgsql'] ]
|
||||
}
|
||||
|
||||
file { '/usr/local/icinga-pgsql/etc/idomod.cfg':
|
||||
source => '/usr/local/icinga-pgsql/etc/idomod.cfg-sample',
|
||||
owner => 'icinga',
|
||||
group => 'icinga',
|
||||
require => Cmmi['icinga-pgsql'],
|
||||
notify => [ Service['icinga-pgsql'], Service['ido2db-pgsql'] ]
|
||||
}
|
||||
|
||||
file { '/usr/local/icinga-pgsql/etc/modules/idoutils.cfg':
|
||||
source => '/usr/local/icinga-pgsql/etc/modules/idoutils.cfg-sample',
|
||||
owner => 'icinga',
|
||||
group => 'icinga',
|
||||
require => Cmmi['icinga-pgsql'],
|
||||
notify => [ Service['icinga-pgsql'], Service['ido2db-pgsql'] ]
|
||||
}
|
||||
|
||||
exec { 'iptables-allow-http':
|
||||
unless => 'grep -Fxqe "-A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT" /etc/sysconfig/iptables',
|
||||
command => 'iptables -I INPUT 5 -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT && iptables-save > /etc/sysconfig/iptables'
|
||||
}
|
||||
|
||||
exec { 'icinga-htpasswd':
|
||||
creates => '/usr/share/icinga/htpasswd.users',
|
||||
command => 'mkdir -p /usr/share/icinga && htpasswd -b -c /usr/share/icinga/htpasswd.users icingaadmin icinga',
|
||||
require => Class['apache']
|
||||
}
|
||||
|
||||
include monitoring-plugins
|
||||
|
||||
cmmi { 'mk-livestatus':
|
||||
url => "http://mathias-kettner.de/download/mk-livestatus-${livestatusVersion}.tar.gz",
|
||||
output => "mk-livestatus-${livestatusVersion}.tar.gz",
|
||||
flags => '--prefix=/usr/local/icinga-mysql --exec-prefix=/usr/local/icinga-mysql',
|
||||
creates => '/usr/local/icinga-mysql/lib/mk-livestatus',
|
||||
make => 'make && make install',
|
||||
require => Cmmi['icinga-mysql']
|
||||
}
|
||||
|
||||
file { '/usr/local/icinga-mysql/etc/modules/mk-livestatus.cfg':
|
||||
content => template('mk-livestatus/mk-livestatus.cfg.erb'),
|
||||
owner => 'icinga',
|
||||
group => 'icinga',
|
||||
require => Cmmi['mk-livestatus'],
|
||||
notify => [ Service['icinga-mysql'], Service['ido2db-mysql'] ]
|
||||
}
|
||||
|
||||
file { 'openldap/db.ldif':
|
||||
path => '/usr/share/openldap-servers/db.ldif',
|
||||
source => 'puppet:///modules/openldap/db.ldif',
|
||||
require => Class['openldap']
|
||||
}
|
||||
|
||||
file { 'openldap/dit.ldif':
|
||||
path => '/usr/share/openldap-servers/dit.ldif',
|
||||
source => 'puppet:///modules/openldap/dit.ldif',
|
||||
require => Class['openldap']
|
||||
}
|
||||
|
||||
file { 'openldap/users.ldif':
|
||||
path => '/usr/share/openldap-servers/users.ldif',
|
||||
source => 'puppet:///modules/openldap/users.ldif',
|
||||
require => Class['openldap']
|
||||
}
|
||||
|
||||
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'],
|
||||
File['openldap/dit.ldif'], File['openldap/users.ldif'] ]
|
||||
}
|
||||
|
||||
class { 'phantomjs':
|
||||
url => "https://phantomjs.googlecode.com/files/phantomjs-${phantomjsVersion}-linux-x86_64.tar.bz2",
|
||||
output => "phantomjs-${phantomjsVersion}-linux-x86_64.tar.bz2",
|
||||
creates => '/usr/local/phantomjs'
|
||||
}
|
||||
|
||||
class { 'casperjs':
|
||||
url => "https://github.com/n1k0/casperjs/tarball/${casperjsVersion}",
|
||||
output => "casperjs-${casperjsVersion}.tar.gz",
|
||||
creates => '/usr/local/casperjs'
|
||||
}
|
||||
|
||||
file { '/etc/profile.d/env.sh':
|
||||
source => 'puppet:////vagrant/.vagrant-puppet/files/etc/profile.d/env.sh'
|
||||
}
|
||||
|
||||
include epel
|
||||
|
||||
exec { 'install PHPUnit':
|
||||
command => 'yum -d 0 -e 0 -y --enablerepo=epel install php-phpunit-PHPUnit',
|
||||
unless => 'rpm -qa | grep php-phpunit-PHPUnit',
|
||||
require => Class['epel']
|
||||
}
|
||||
|
||||
exec { 'install PHP CodeSniffer':
|
||||
command => 'yum -d 0 -e 0 -y --enablerepo=epel install php-pear-PHP-CodeSniffer',
|
||||
unless => 'rpm -qa | grep php-pear-PHP-CodeSniffer',
|
||||
require => Class['epel']
|
||||
}
|
||||
|
||||
exec { 'install nodejs':
|
||||
command => 'yum -d 0 -e 0 -y --enablerepo=epel install npm',
|
||||
unless => 'rpm -qa | grep ^npm',
|
||||
require => Class['epel']
|
||||
}
|
||||
|
||||
exec { 'install npm/mocha':
|
||||
command => 'npm install -g mocha',
|
||||
creates => '/usr/lib/node_modules/mocha',
|
||||
require => Exec['install nodejs']
|
||||
}
|
||||
|
||||
exec { 'install npm/mocha-cobertura-reporter':
|
||||
command => 'npm install -g mocha-cobertura-reporter',
|
||||
creates => '/usr/lib/node_modules/mocha-cobertura-reporter',
|
||||
require => Exec['install npm/mocha']
|
||||
}
|
||||
|
||||
exec { 'install npm/jshint':
|
||||
command => 'npm install -g jshint',
|
||||
creates => '/usr/lib/node_modules/jshint',
|
||||
require => Exec['install nodejs']
|
||||
}
|
||||
|
||||
exec { 'install npm/expect':
|
||||
command => 'npm install -g expect',
|
||||
creates => '/usr/lib/node_modules/expect',
|
||||
require => Exec['install nodejs']
|
||||
}
|
||||
|
||||
exec { 'install npm/should':
|
||||
command => 'npm install -g should',
|
||||
creates => '/usr/lib/node_modules/should',
|
||||
require => Exec['install nodejs']
|
||||
}
|
||||
|
||||
exec { 'install npm/URIjs':
|
||||
command => 'npm install -g URIjs',
|
||||
creates => '/usr/lib/node_modules/URIjs',
|
||||
require => Exec['install nodejs']
|
||||
}
|
||||
|
||||
exec { 'install php-ZendFramework':
|
||||
command => 'yum -d 0 -e 0 -y --enablerepo=epel install php-ZendFramework',
|
||||
unless => 'rpm -qa | grep php-ZendFramework',
|
||||
require => Class['epel']
|
||||
}
|
||||
|
||||
package { ['cmake', 'boost-devel', 'bison', 'flex']:
|
||||
ensure => installed
|
||||
}
|
||||
|
||||
# icinga 2
|
||||
define icinga2::feature ($feature = $title) {
|
||||
exec { "icinga2-feature-${feature}":
|
||||
path => '/bin:/usr/bin:/sbin:/usr/sbin',
|
||||
unless => "readlink /etc/icinga2/features-enabled/${feature}.conf",
|
||||
command => "icinga2-enable-feature ${feature}",
|
||||
require => [ Package['icinga2'] ],
|
||||
notify => Service['icinga2']
|
||||
}
|
||||
}
|
||||
|
||||
yumrepo { 'icinga2-repo':
|
||||
baseurl => "http://packages.icinga.org/epel/6/snapshot/",
|
||||
enabled => '1',
|
||||
gpgcheck => '1',
|
||||
gpgkey => 'http://packages.icinga.org/icinga.key',
|
||||
descr => "Icinga Repository - ${::architecture}"
|
||||
}
|
||||
|
||||
exec { 'install nagios-plugins-all':
|
||||
command => 'yum -d 0 -e 0 -y --enablerepo=epel install nagios-plugins-all',
|
||||
unless => 'rpm -qa | grep nagios-plugins-all',
|
||||
require => [ Class['epel'], Package['icinga2'] ],
|
||||
}
|
||||
|
||||
package { 'icinga2':
|
||||
ensure => latest,
|
||||
require => Yumrepo['icinga2-repo'],
|
||||
alias => 'icinga2'
|
||||
}
|
||||
|
||||
package { 'icinga2-bin':
|
||||
ensure => latest,
|
||||
require => [ Yumrepo['icinga2-repo'], Package['icinga2'] ],
|
||||
alias => 'icinga2-bin'
|
||||
}
|
||||
|
||||
package { 'icinga2-doc':
|
||||
ensure => latest,
|
||||
require => Yumrepo['icinga2-repo'],
|
||||
alias => 'icinga2-doc'
|
||||
}
|
||||
|
||||
# icinga 2 classic ui
|
||||
package { 'icinga2-classicui-config':
|
||||
ensure => latest,
|
||||
before => Package["icinga-gui"],
|
||||
require => [ Yumrepo['icinga2-repo'], Package['icinga2'] ],
|
||||
notify => Service['apache']
|
||||
}
|
||||
|
||||
package { 'icinga-gui':
|
||||
ensure => latest,
|
||||
require => Yumrepo['icinga2-repo'],
|
||||
alias => 'icinga-gui'
|
||||
}
|
||||
|
||||
icinga2::feature { 'statusdata':
|
||||
require => Package['icinga2-classicui-config']
|
||||
}
|
||||
|
||||
icinga2::feature { 'command':
|
||||
require => Package['icinga2-classicui-config']
|
||||
}
|
||||
|
||||
icinga2::feature { 'compatlog':
|
||||
require => Package['icinga2-classicui-config']
|
||||
}
|
||||
|
||||
# icinga 2 ido mysql
|
||||
package { 'icinga2-ido-mysql':
|
||||
ensure => latest,
|
||||
require => Yumrepo['icinga2-repo'],
|
||||
alias => 'icinga2-ido-mysql'
|
||||
}
|
||||
|
||||
exec { 'populate-icinga2-mysql-db':
|
||||
unless => 'mysql -uicinga2 -picinga2 icinga2 -e "SELECT * FROM icinga_dbversion;" &> /dev/null',
|
||||
command => 'mysql -uroot icinga2 < /usr/share/icinga2-ido-mysql/schema/mysql.sql',
|
||||
require => [ Exec['create-mysql-icinga2-db'], Package['icinga2-ido-mysql'] ]
|
||||
}
|
||||
|
||||
file { '/etc/icinga2/features-available/ido-mysql.conf':
|
||||
source => 'puppet:////vagrant/.vagrant-puppet/files/etc/icinga2/features-available/ido-mysql.conf',
|
||||
owner => 'icinga',
|
||||
group => 'icinga',
|
||||
require => Package['icinga2'],
|
||||
notify => Service['icinga2']
|
||||
}
|
||||
|
||||
file { '/etc/icinga2/features-enabled/ido-mysql.conf':
|
||||
ensure => 'link',
|
||||
target => '/etc/icinga2/features-available/ido-mysql.conf',
|
||||
owner => 'root',
|
||||
group => 'root',
|
||||
require => Package['icinga2-ido-mysql']
|
||||
}
|
||||
|
||||
icinga2::feature { 'ido-mysql':
|
||||
require => Exec['populate-icinga2-mysql-db']
|
||||
}
|
||||
|
||||
|
||||
# icinga 2 test config
|
||||
file { '/etc/icinga2/conf.d/test-config.conf':
|
||||
source => 'puppet:////vagrant/.vagrant-puppet/files/etc/icinga2/conf.d/test-config.conf',
|
||||
owner => 'icinga',
|
||||
group => 'icinga',
|
||||
require => [ Package['icinga2'], Exec['create_monitoring_test_config'] ]
|
||||
}
|
||||
|
||||
file { '/etc/icinga2/conf.d/commands.conf':
|
||||
source => 'puppet:////vagrant/.vagrant-puppet/files/etc/icinga2/conf.d/commands.conf',
|
||||
owner => 'icinga',
|
||||
group => 'icinga',
|
||||
require => Package['icinga2']
|
||||
}
|
||||
|
||||
file { '/etc/icinga2/constants.conf':
|
||||
source => 'puppet:////vagrant/.vagrant-puppet/files/etc/icinga2/constants.conf',
|
||||
owner => 'icinga',
|
||||
group => 'icinga',
|
||||
require => Package['icinga2']
|
||||
}
|
||||
|
||||
service { 'icinga2':
|
||||
ensure => running,
|
||||
require => [
|
||||
Package['icinga2'],
|
||||
File['/etc/icinga2/features-enabled/ido-mysql.conf'],
|
||||
File['/etc/icinga2/conf.d/test-config.conf'],
|
||||
File['/etc/icinga2/conf.d/commands.conf']
|
||||
]
|
||||
}
|
||||
|
||||
exec { 'install php-ZendFramework-Db-Adapter-Pdo-Mysql':
|
||||
command => 'yum -d 0 -e 0 -y --enablerepo=epel install php-ZendFramework-Db-Adapter-Pdo-Mysql',
|
||||
unless => 'rpm -qa | grep php-ZendFramework-Db-Adapter-Pdo-Mysql',
|
||||
require => Exec['install php-ZendFramework']
|
||||
}
|
||||
|
||||
file { '/etc/motd':
|
||||
source => 'puppet:////vagrant/.vagrant-puppet/files/etc/motd',
|
||||
owner => root,
|
||||
group => root
|
||||
}
|
||||
|
||||
user { 'vagrant':
|
||||
groups => 'icinga-cmd',
|
||||
require => Group['icinga-cmd']
|
||||
}
|
||||
|
||||
exec { 'create-mysql-icinga_unittest-db':
|
||||
unless => 'mysql -uicinga_unittest -picinga_unittest icinga_unittest',
|
||||
command => 'mysql -uroot -e "CREATE DATABASE icinga_unittest; \
|
||||
GRANT ALL ON icinga_unittest.* TO icinga_unittest@localhost \
|
||||
IDENTIFIED BY \'icinga_unittest\';"',
|
||||
require => Service['mysqld']
|
||||
}
|
||||
|
||||
exec{ 'create-pgsql-icinga_unittest-db':
|
||||
unless => 'sudo -u postgres psql -tAc "SELECT 1 FROM pg_roles WHERE rolname=\'icinga_unittest\'" | grep -q 1',
|
||||
command => 'sudo -u postgres psql -c "CREATE ROLE icinga_unittest WITH LOGIN PASSWORD \'icinga_unittest\';" && \
|
||||
sudo -u postgres createdb -O icinga_unittest -E UTF8 -T template0 icinga_unittest && \
|
||||
sudo -u postgres createlang plpgsql icinga_unittest',
|
||||
require => Service['postgresql']
|
||||
}
|
||||
|
||||
exec { 'install php-ZendFramework-Db-Adapter-Pdo-Pgsql':
|
||||
command => 'yum -d 0 -e 0 -y --enablerepo=epel install php-ZendFramework-Db-Adapter-Pdo-Pgsql',
|
||||
unless => 'rpm -qa | grep php-ZendFramework-Db-Adapter-Pdo-Pgsql',
|
||||
require => Exec['install php-ZendFramework']
|
||||
}
|
||||
|
||||
|
||||
#
|
||||
# Following section installs the Perl module Monitoring::Generator::TestConfig in order to create test config to
|
||||
# */usr/local/share/misc/monitoring_test_config*. Then the config is copied to *<instance>/etc/conf.d/test_config/* of
|
||||
# both the MySQL and PostgreSQL Icinga instance
|
||||
#
|
||||
cpan { 'Monitoring::Generator::TestConfig':
|
||||
creates => '/usr/local/share/perl5/Monitoring/Generator/TestConfig.pm',
|
||||
timeout => 600
|
||||
}
|
||||
|
||||
exec { 'create_monitoring_test_config':
|
||||
command => 'sudo install -o root -g root -d /usr/local/share/misc/ && \
|
||||
sudo /usr/local/bin/create_monitoring_test_config.pl -l icinga \
|
||||
/usr/local/share/misc/monitoring_test_config',
|
||||
creates => '/usr/local/share/misc/monitoring_test_config',
|
||||
require => Cpan['Monitoring::Generator::TestConfig']
|
||||
}
|
||||
|
||||
define populate_monitoring_test_config {
|
||||
file { "/usr/local/icinga-mysql/etc/conf.d/test_config/${name}.cfg":
|
||||
owner => 'icinga',
|
||||
group => 'icinga',
|
||||
source => "/usr/local/share/misc/monitoring_test_config/etc/conf.d/${name}.cfg",
|
||||
notify => Service['icinga-mysql']
|
||||
}
|
||||
file { "/usr/local/icinga-pgsql/etc/conf.d/test_config/${name}.cfg":
|
||||
owner => 'icinga',
|
||||
group => 'icinga',
|
||||
source => "/usr/local/share/misc/monitoring_test_config/etc/conf.d/${name}.cfg",
|
||||
notify => Service['icinga-pgsql']
|
||||
}
|
||||
}
|
||||
|
||||
file { '/usr/local/icinga-mysql/etc/conf.d/test_config/':
|
||||
ensure => directory,
|
||||
owner => icinga,
|
||||
group => icinga,
|
||||
require => Cmmi['icinga-mysql']
|
||||
}
|
||||
|
||||
file { '/usr/local/icinga-pgsql/etc/conf.d/test_config/':
|
||||
ensure => directory,
|
||||
owner => icinga,
|
||||
group => icinga,
|
||||
require => Cmmi['icinga-pgsql']
|
||||
}
|
||||
|
||||
populate_monitoring_test_config { ['commands', 'contacts', 'dependencies',
|
||||
'hostgroups', 'hosts', 'servicegroups', 'services']:
|
||||
require => [ Exec['create_monitoring_test_config'],
|
||||
File['/usr/local/icinga-mysql/etc/conf.d/test_config/'],
|
||||
File['/usr/local/icinga-pgsql/etc/conf.d/test_config/'] ]
|
||||
}
|
||||
|
||||
define populate_monitoring_test_config_plugins {
|
||||
file { "/usr/lib64/nagios/plugins/${name}":
|
||||
owner => 'icinga',
|
||||
group => 'icinga',
|
||||
source => "/usr/local/share/misc/monitoring_test_config/plugins/${name}",
|
||||
notify => [ Service['icinga-mysql'], Service['icinga-pgsql'] ]
|
||||
}
|
||||
}
|
||||
|
||||
populate_monitoring_test_config_plugins{ ['test_hostcheck.pl', 'test_servicecheck.pl']:
|
||||
require => [ Exec['create_monitoring_test_config'],
|
||||
Cmmi['icinga-mysql'],
|
||||
Cmmi['icinga-pgsql'] ]
|
||||
}
|
||||
|
||||
#
|
||||
# Following section creates and populates MySQL and PostgreSQL Icinga Web 2 databases
|
||||
#
|
||||
exec { 'create-mysql-icingaweb-db':
|
||||
unless => 'mysql -uicingaweb -picingaweb icingaweb',
|
||||
command => 'mysql -uroot -e "CREATE DATABASE icingaweb; \
|
||||
GRANT ALL ON icingaweb.* TO icingaweb@localhost \
|
||||
IDENTIFIED BY \'icingaweb\';"',
|
||||
require => Service['mysqld']
|
||||
}
|
||||
|
||||
exec { 'create-pgsql-icingaweb-db':
|
||||
unless => 'sudo -u postgres psql -tAc "SELECT 1 FROM pg_roles WHERE rolname=\'icingaweb\'" | grep -q 1',
|
||||
command => 'sudo -u postgres psql -c "CREATE ROLE icingaweb WITH LOGIN PASSWORD \'icinga\';" && \
|
||||
sudo -u postgres createdb -O icingaweb -E UTF8 -T template0 icingaweb && \
|
||||
sudo -u postgres createlang plpgsql icingaweb',
|
||||
require => Service['postgresql']
|
||||
}
|
||||
|
||||
exec { 'populate-icingaweb-mysql-db-tables':
|
||||
unless => 'mysql -uicingaweb -picingaweb icingaweb -e "SELECT * FROM icingaweb_group;" &> /dev/null',
|
||||
command => 'mysql -uicingaweb -picingaweb icingaweb < /vagrant/etc/schema/mysql.schema.sql',
|
||||
require => [ Exec['create-mysql-icingaweb-db'] ]
|
||||
}
|
||||
|
||||
exec { 'populate-icingweba-pgsql-db-tables':
|
||||
unless => 'psql -U icingaweb -d icingaweb -c "SELECT * FROM icingaweb_group;" &> /dev/null',
|
||||
command => 'sudo -u postgres psql -U icingaweb -d icingaweb -f /vagrant/etc/schema/pgsql.schema.sql',
|
||||
require => [ Exec['create-pgsql-icingaweb-db'] ]
|
||||
}
|
||||
|
||||
#
|
||||
# Following section creates the Icinga command proxy to /usr/local/icinga-mysql/var/rw/icinga.cmd (which is the
|
||||
# config's default path for the Icinga command pipe) in order to send commands to both the MySQL and PostgreSQL instance
|
||||
#
|
||||
file { [ '/usr/local/icinga/', '/usr/local/icinga/var/', '/usr/local/icinga/var/rw/' ]:
|
||||
ensure => directory,
|
||||
owner => icinga,
|
||||
group => icinga,
|
||||
require => User['icinga']
|
||||
}
|
||||
|
||||
file { '/usr/local/bin/icinga_command_proxy':
|
||||
source => 'puppet:////vagrant/.vagrant-puppet/files/usr/local/bin/icinga_command_proxy',
|
||||
owner => root,
|
||||
group => root,
|
||||
mode => 755
|
||||
}
|
||||
|
||||
file { '/etc/init.d/icinga_command_proxy':
|
||||
source => 'puppet:////vagrant/.vagrant-puppet/files/etc/init.d/icinga_command_proxy',
|
||||
owner => root,
|
||||
group => root,
|
||||
mode => 755,
|
||||
require => File['/usr/local/bin/icinga_command_proxy']
|
||||
}
|
||||
|
||||
service { 'icinga_command_proxy':
|
||||
ensure => running,
|
||||
require => [ File['/etc/init.d/icinga_command_proxy'], Service['icinga-mysql'], Service['icinga-pgsql'] ]
|
||||
}
|
||||
|
||||
exec { 'create-mysql-icinga_web-db':
|
||||
unless => 'mysql -uicinga_web -picinga_web icinga_web',
|
||||
command => 'mysql -uroot -e "CREATE DATABASE icinga_web; \
|
||||
GRANT ALL ON icinga_web.* TO icinga_web@localhost \
|
||||
IDENTIFIED BY \'icinga_web\';"',
|
||||
require => Service['mysqld']
|
||||
}
|
||||
|
||||
cmmi { 'icinga-web':
|
||||
url => 'http://sourceforge.net/projects/icinga/files/icinga-web/1.10.0-beta/icinga-web-1.10.0-beta.tar.gz/download',
|
||||
output => 'icinga-web-1.10.0-beta.tar.gz',
|
||||
flags => '--prefix=/usr/local/icinga-web',
|
||||
creates => '/usr/local/icinga-web',
|
||||
make => 'make install && make install-apache-config',
|
||||
require => Service['icinga_command_proxy'],
|
||||
notify => Service['apache']
|
||||
}
|
||||
|
||||
exec { 'populate-icinga_web-mysql-db':
|
||||
unless => 'mysql -uicinga_web -picinga_web icinga_web -e "SELECT * FROM nsm_user;" &> /dev/null',
|
||||
command => 'mysql -uicinga_web -picinga_web icinga_web < /usr/local/src/icinga-web/icinga-web-1.10.0-beta/etc/schema/mysql.sql',
|
||||
require => [ Exec['create-mysql-icinga_web-db'], Cmmi['icinga-web'] ]
|
||||
}
|
||||
|
||||
file { '/var/www/html/icingaweb':
|
||||
ensure => absent,
|
||||
}
|
||||
|
||||
file { '/etc/httpd/conf.d/icingaweb.conf':
|
||||
source => 'puppet:////vagrant/.vagrant-puppet/files/etc/httpd/conf.d/icingaweb.conf',
|
||||
require => Package['apache'],
|
||||
notify => Service['apache']
|
||||
}
|
||||
|
||||
file { '/etc/icingaweb':
|
||||
ensure => 'directory',
|
||||
owner => 'apache',
|
||||
group => 'apache'
|
||||
}
|
||||
|
||||
file { '/etc/icingaweb/preferences':
|
||||
ensure => 'directory',
|
||||
owner => 'apache',
|
||||
group => 'apache',
|
||||
require => File['/etc/icingaweb']
|
||||
}
|
||||
|
||||
file { '/etc/icingaweb/authentication.ini':
|
||||
source => 'puppet:////vagrant/.vagrant-puppet/files/etc/icingaweb/authentication.ini',
|
||||
owner => 'apache',
|
||||
group => 'apache',
|
||||
require => File['/etc/icingaweb']
|
||||
}
|
||||
|
||||
file { '/etc/icingaweb/config.ini':
|
||||
ensure => file,
|
||||
owner => 'apache',
|
||||
group => 'apache',
|
||||
}
|
||||
|
||||
file { '/etc/icingaweb/resources.ini':
|
||||
source => 'puppet:////vagrant/.vagrant-puppet/files/etc/icingaweb/resources.ini',
|
||||
owner => 'apache',
|
||||
group => 'apache',
|
||||
replace => false
|
||||
}
|
||||
|
||||
file { ['/etc/icingaweb/enabledModules', '/etc/icingaweb/modules', '/etc/icingaweb/modules/monitoring']:
|
||||
ensure => 'directory',
|
||||
owner => 'apache',
|
||||
group => 'apache',
|
||||
}
|
||||
|
||||
file { '/etc/icingaweb/modules/monitoring/backends.ini':
|
||||
source => 'puppet:////vagrant/.vagrant-puppet/files/etc/icingaweb/modules/monitoring/backends.ini',
|
||||
owner => 'apache',
|
||||
group => 'apache',
|
||||
}
|
||||
|
||||
file { '/etc/icingaweb/modules/monitoring/config.ini':
|
||||
source => 'puppet:////vagrant/config/modules/monitoring/config.ini',
|
||||
owner => 'apache',
|
||||
group => 'apache',
|
||||
}
|
||||
|
||||
file { '/etc/icingaweb/modules/monitoring/instances.ini':
|
||||
source => 'puppet:////vagrant/.vagrant-puppet/files/etc/icingaweb/modules/monitoring/instances.ini',
|
||||
owner => 'apache',
|
||||
group => 'apache',
|
||||
}
|
||||
|
||||
# pear::package { 'deepend/Mockery':
|
||||
# channel => 'pear.survivethedeepend.com'
|
||||
# }
|
||||
|
||||
# icingacli
|
||||
file { '/usr/local/bin/icingacli':
|
||||
ensure => 'link',
|
||||
target => '/vagrant/bin/icingacli',
|
||||
owner => 'apache',
|
||||
group => 'apache',
|
||||
require => [ File['/etc/icingaweb'], File['/etc/bash_completion.d/icingacli'] ]
|
||||
}
|
||||
|
||||
exec { 'install bash-completion':
|
||||
command => 'yum -d 0 -e 0 -y --enablerepo=epel install bash-completion',
|
||||
unless => 'rpm -qa | grep bash-completion',
|
||||
require => Class['epel']
|
||||
}
|
||||
|
||||
file { '/etc/bash_completion.d/icingacli':
|
||||
source => 'puppet:////vagrant/etc/bash_completion.d/icingacli',
|
||||
owner => 'root',
|
||||
group => 'root',
|
||||
mode => 755,
|
||||
require => Exec['install bash-completion']
|
||||
}
|
|
@ -1,33 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
startServicesWithNonLSBCompliantExitStatusCodes () {
|
||||
# Unfortunately the ido2db init script is not LSB compliant and hence not started via puppet
|
||||
service ido2db-mysql start || true
|
||||
service ido2db-pgsql start || true
|
||||
}
|
||||
|
||||
mountIcinga2webVarLog () {
|
||||
if ! $(/bin/mount | /bin/grep -q "/vagrant/var/log"); then
|
||||
# Remount /vagrant/var/log/ with appropriate permissions since the group apache is missing initially
|
||||
/bin/mount -t vboxsf -o \
|
||||
uid=`id -u vagrant`,gid=`id -g apache`,dmode=775,fmode=664 \
|
||||
/vagrant/var/log/ \
|
||||
/vagrant/var/log/
|
||||
fi
|
||||
}
|
||||
|
||||
installJquery
|
||||
startServicesWithNonLSBCompliantExitStatusCodes
|
||||
mountIcinga2webVarLog
|
||||
|
||||
exit 0
|
|
@ -1,66 +0,0 @@
|
|||
# Class: casperjs
|
||||
#
|
||||
# This module downloads, extracts, and installs casperjs tar.gz archives
|
||||
# using wget and tar.
|
||||
#
|
||||
# Parameters:
|
||||
# [*url*] - fetch archive via wget from this url.
|
||||
# [*output*] - filename to fetch the archive into.
|
||||
# [*creates*] - target directory the software will install to.
|
||||
#
|
||||
# Actions:
|
||||
#
|
||||
# Requires:
|
||||
#
|
||||
# Sample Usage:
|
||||
#
|
||||
# class {'casperjs':
|
||||
# url => 'https://github.com/n1k0/casperjs/tarball/1.0.2',
|
||||
# output => 'casperjs-1.0.2.tar.gz',
|
||||
# creates => '/usr/local/casperjs'
|
||||
# }
|
||||
#
|
||||
class casperjs(
|
||||
$url,
|
||||
$output,
|
||||
$creates
|
||||
) {
|
||||
|
||||
Exec { path => '/usr/bin:/bin' }
|
||||
|
||||
$cwd = '/usr/local/src'
|
||||
|
||||
include wget
|
||||
|
||||
exec { 'download-casperjs':
|
||||
cwd => $cwd,
|
||||
command => "wget -q ${url} -O ${output}",
|
||||
creates => "${cwd}/${output}",
|
||||
timeout => 120,
|
||||
require => Class['wget']
|
||||
}
|
||||
|
||||
$tld = inline_template('<%= File.basename(@output, ".tar.bz2") %>')
|
||||
$src = "${cwd}/casperjs"
|
||||
|
||||
exec { 'extract-casperjs':
|
||||
cwd => $cwd,
|
||||
command => "mkdir -p casperjs && tar --no-same-owner \
|
||||
--no-same-permissions -xzf ${output} -C ${src} \
|
||||
--strip-components 1",
|
||||
creates => $src,
|
||||
require => Exec['download-casperjs']
|
||||
}
|
||||
|
||||
file { 'install-casperjs':
|
||||
path => $creates,
|
||||
source => $src,
|
||||
recurse => true,
|
||||
require => Exec['extract-casperjs']
|
||||
}
|
||||
|
||||
file { 'link-casperjs-bin':
|
||||
ensure => "${creates}/bin/casperjs",
|
||||
path => '/usr/local/bin/casperjs'
|
||||
}
|
||||
}
|
|
@ -1,80 +0,0 @@
|
|||
# Define: cmmi
|
||||
#
|
||||
# This module downloads, extracts, builds and installs tar.gz archives using
|
||||
# wget, tar and the autotools stack. Build directory is always /usr/local/src.
|
||||
#
|
||||
# *Note* make sure to install build essentials before running cmmi.
|
||||
#
|
||||
# Parameters:
|
||||
# [*url*] - fetch archive via wget from this url.
|
||||
# [*output*] - filename to fetch the archive into.
|
||||
# [*flags*] - configure options.
|
||||
# [*creates*] - target directory the software will install to.
|
||||
# [*make* ] - command to make and make install the software.
|
||||
# [*make_timeout* ] - timeout for the make command.
|
||||
#
|
||||
# Actions:
|
||||
#
|
||||
# Requires:
|
||||
#
|
||||
# Sample Usage:
|
||||
#
|
||||
# cmmi { 'example-software':
|
||||
# url => 'http://example-software.com/download/',
|
||||
# output => 'example-software.tar.gz',
|
||||
# flags => '--prefix=/opt/example-software',
|
||||
# creates => '/opt/example-software',
|
||||
# make => 'make && make install'
|
||||
# make_timeout => 600
|
||||
# }
|
||||
#
|
||||
define cmmi(
|
||||
$url,
|
||||
$output,
|
||||
$flags='',
|
||||
$creates,
|
||||
$make,
|
||||
$make_timeout=300,
|
||||
$configure_command='sh ./configure'
|
||||
) {
|
||||
|
||||
Exec { path => '/bin:/usr/bin' }
|
||||
|
||||
$cwd = '/usr/local/src'
|
||||
|
||||
include wget
|
||||
|
||||
exec { "download-${name}":
|
||||
cwd => $cwd,
|
||||
command => "wget -q \"${url}\" -O ${output}",
|
||||
creates => "${cwd}/${output}",
|
||||
require => Class['wget']
|
||||
}
|
||||
|
||||
$tld = inline_template('<%= File.basename(@output, ".tar.gz") %>')
|
||||
$src = "${cwd}/${name}/${tld}"
|
||||
|
||||
exec { "extract-${name}":
|
||||
cwd => $cwd,
|
||||
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}"]
|
||||
}
|
||||
|
||||
exec { "configure-${name}":
|
||||
cwd => $src,
|
||||
command => "${configure_command} ${flags}",
|
||||
creates => "${src}/Makefile",
|
||||
require => Exec["extract-${name}"]
|
||||
}
|
||||
|
||||
exec { "make-${name}":
|
||||
cwd => $src,
|
||||
command => $make,
|
||||
creates => $creates,
|
||||
require => Exec["configure-${name}"],
|
||||
timeout => $make_timeout
|
||||
}
|
||||
}
|
|
@ -1,17 +0,0 @@
|
|||
# Define: configure
|
||||
#
|
||||
# Run a gnu configure to prepare software for environment
|
||||
#
|
||||
# Parameters:
|
||||
# [*flags*] - configure options.
|
||||
# [*path*] - Target and working dir
|
||||
#
|
||||
define configure(
|
||||
$path,
|
||||
$flags
|
||||
) {
|
||||
exec { "configure-${name}":
|
||||
cwd => $path,
|
||||
command => "sh ./configure ${flags}"
|
||||
}
|
||||
}
|
|
@ -1,49 +0,0 @@
|
|||
# Define: cpan
|
||||
#
|
||||
# Download and install Perl modules from the Perl Archive Network, the canonical location for Perl code and modules.
|
||||
#
|
||||
# Parameters:
|
||||
# [*creates*] - target directory the software will install to.
|
||||
# [*timeout* ] - timeout for the CPAN command.
|
||||
#
|
||||
# Actions:
|
||||
#
|
||||
# Requires:
|
||||
#
|
||||
# Perl
|
||||
#
|
||||
# Sample Usage:
|
||||
#
|
||||
# cpan { 'perl-module':
|
||||
# creates => '/usr/local/share/perl5/perl-module',
|
||||
# timeout => 600
|
||||
# }
|
||||
#
|
||||
define cpan(
|
||||
$creates,
|
||||
$timeout
|
||||
) {
|
||||
|
||||
Exec { path => '/usr/bin' }
|
||||
|
||||
package { 'perl-CPAN':
|
||||
ensure => installed
|
||||
}
|
||||
|
||||
file { [ '/root/.cpan/', '/root/.cpan/CPAN/' ]:
|
||||
ensure => directory
|
||||
}
|
||||
|
||||
file { '/root/.cpan/CPAN/MyConfig.pm':
|
||||
content => template('cpan/MyConfig.pm.erb'),
|
||||
require => [ Package['perl-CPAN'],
|
||||
File[[ '/root/.cpan/', '/root/.cpan/CPAN/' ]] ]
|
||||
}
|
||||
|
||||
exec { "cpan-${name}":
|
||||
command => "sudo perl -MCPAN -e 'install ${name}'",
|
||||
creates => $creates,
|
||||
require => File['/root/.cpan/CPAN/MyConfig.pm'],
|
||||
timeout => $timeout
|
||||
}
|
||||
}
|
|
@ -1,68 +0,0 @@
|
|||
$CPAN::Config = {
|
||||
'applypatch' => q[],
|
||||
'auto_commit' => q[0],
|
||||
'build_cache' => q[100],
|
||||
'build_dir' => q[/root/.cpan/build],
|
||||
'build_dir_reuse' => q[0],
|
||||
'build_requires_install_policy' => q[ask/yes],
|
||||
'bzip2' => q[/usr/bin/bzip2],
|
||||
'cache_metadata' => q[1],
|
||||
'check_sigs' => q[0],
|
||||
'commandnumber_in_prompt' => q[1],
|
||||
'connect_to_internet_ok' => q[1],
|
||||
'cpan_home' => q[/root/.cpan],
|
||||
'curl' => q[/usr/bin/curl],
|
||||
'ftp' => q[],
|
||||
'ftp_passive' => q[1],
|
||||
'ftp_proxy' => q[],
|
||||
'getcwd' => q[cwd],
|
||||
'gpg' => q[/usr/bin/gpg],
|
||||
'gzip' => q[/bin/gzip],
|
||||
'halt_on_failure' => q[0],
|
||||
'histfile' => q[/root/.cpan/histfile],
|
||||
'histsize' => q[100],
|
||||
'http_proxy' => q[],
|
||||
'inactivity_timeout' => q[0],
|
||||
'index_expire' => q[1],
|
||||
'inhibit_startup_message' => q[0],
|
||||
'keep_source_where' => q[/root/.cpan/sources],
|
||||
'load_module_verbosity' => q[v],
|
||||
'lynx' => q[],
|
||||
'make' => q[/usr/bin/make],
|
||||
'make_arg' => q[],
|
||||
'make_install_arg' => q[],
|
||||
'make_install_make_command' => q[/usr/bin/make],
|
||||
'makepl_arg' => q[INSTALLDIRS=site],
|
||||
'mbuild_arg' => q[],
|
||||
'mbuild_install_arg' => q[],
|
||||
'mbuild_install_build_command' => q[./Build],
|
||||
'mbuildpl_arg' => q[--installdirs site],
|
||||
'ncftp' => q[],
|
||||
'ncftpget' => q[],
|
||||
'no_proxy' => q[],
|
||||
'pager' => q[/usr/bin/less],
|
||||
'patch' => q[],
|
||||
'perl5lib_verbosity' => q[v],
|
||||
'prefer_installer' => q[MB],
|
||||
'prefs_dir' => q[/root/.cpan/prefs],
|
||||
'prerequisites_policy' => q[follow],
|
||||
'scan_cache' => q[atstart],
|
||||
'shell' => q[/bin/bash],
|
||||
'show_unparsable_versions' => q[0],
|
||||
'show_upload_date' => q[0],
|
||||
'show_zero_versions' => q[0],
|
||||
'tar' => q[/bin/tar],
|
||||
'tar_verbosity' => q[v],
|
||||
'term_is_latin' => q[1],
|
||||
'term_ornaments' => q[1],
|
||||
'test_report' => q[0],
|
||||
'trust_test_report_history' => q[0],
|
||||
'unzip' => q[/usr/bin/unzip],
|
||||
'urllist' => [],
|
||||
'use_sqlite' => q[0],
|
||||
'wget' => q[/usr/bin/wget],
|
||||
'yaml_load_code' => q[0],
|
||||
'yaml_module' => q[YAML],
|
||||
};
|
||||
1;
|
||||
__END__
|
|
@ -1,6 +0,0 @@
|
|||
define module{
|
||||
module_name mklivestatus
|
||||
path /usr/local/icinga-mysql/lib/mk-livestatus/livestatus.o
|
||||
module_type neb
|
||||
args /usr/local/icinga-mysql/var/rw/live
|
||||
}
|
|
@ -1,43 +0,0 @@
|
|||
# Class: pear
|
||||
#
|
||||
# This class installs pear.
|
||||
#
|
||||
# Parameters:
|
||||
#
|
||||
# Actions:
|
||||
#
|
||||
# Requires:
|
||||
#
|
||||
# php
|
||||
#
|
||||
# Sample Usage:
|
||||
#
|
||||
# include pear
|
||||
#
|
||||
class pear {
|
||||
|
||||
Exec { path => '/usr/bin:/bin' }
|
||||
|
||||
include php
|
||||
|
||||
package { 'php-pear':
|
||||
ensure => installed,
|
||||
require => Class['php']
|
||||
}
|
||||
|
||||
exec { 'pear upgrade':
|
||||
command => 'pear upgrade',
|
||||
require => Package['php-pear']
|
||||
}
|
||||
|
||||
exec { 'pear update-channels':
|
||||
command => 'pear update-channels',
|
||||
require => Package['php-pear']
|
||||
}
|
||||
|
||||
exec { 'pear auto discover channels':
|
||||
command => 'pear config-set auto_discover 1',
|
||||
unless => 'pear config-get auto_discover | grep 1',
|
||||
require => Package['php-pear']
|
||||
}
|
||||
}
|
|
@ -1,50 +0,0 @@
|
|||
# Define: pear::package
|
||||
#
|
||||
# Install additional PEAR packages
|
||||
#
|
||||
# Parameters:
|
||||
#
|
||||
# Actions:
|
||||
#
|
||||
# Requires:
|
||||
#
|
||||
# pear
|
||||
#
|
||||
# Sample Usage:
|
||||
#
|
||||
# pear::package { 'phpunit': }
|
||||
#
|
||||
define pear::package(
|
||||
$channel
|
||||
) {
|
||||
|
||||
Exec { path => '/usr/bin' }
|
||||
|
||||
include pear
|
||||
|
||||
if $::require {
|
||||
$require_ = [Class['pear'], $::require]
|
||||
} else {
|
||||
$require_ = Class['pear']
|
||||
}
|
||||
|
||||
if $channel {
|
||||
exec { "pear discover ${channel}":
|
||||
command => "sudo pear channel-discover ${channel}",
|
||||
unless => "pear channel-info ${channel}",
|
||||
require => $require_,
|
||||
before => Exec["pear install ${name}"]
|
||||
}
|
||||
}
|
||||
|
||||
exec { "pear install ${name}":
|
||||
command => "pear install --alldeps ${name}",
|
||||
unless => "pear list ${name}",
|
||||
require => $require_
|
||||
}
|
||||
|
||||
exec { "pear upgrade ${name}":
|
||||
command => "pear upgrade ${name}",
|
||||
require => Exec["pear install ${name}"]
|
||||
}
|
||||
}
|
|
@ -1,65 +0,0 @@
|
|||
# Class: phantomjs
|
||||
#
|
||||
# This module downloads, extracts, and installs phantomjs tar.bz2 archives
|
||||
# using wget and tar.
|
||||
#
|
||||
# Parameters:
|
||||
# [*url*] - fetch archive via wget from this url.
|
||||
# [*output*] - filename to fetch the archive into.
|
||||
# [*creates*] - target directory the software will install to.
|
||||
#
|
||||
# Actions:
|
||||
#
|
||||
# Requires:
|
||||
#
|
||||
# Sample Usage:
|
||||
#
|
||||
# class {'phantomjs':
|
||||
# url => 'https://phantomjs.googlecode.com/files/phantomjs-1.9.1-linux-x86_64.tar.bz2',
|
||||
# output => 'phantomjs-1.9.1-linux-x86_64.tar.bz2',
|
||||
# creates => '/usr/local/phantomjs'
|
||||
# }
|
||||
#
|
||||
class phantomjs(
|
||||
$url,
|
||||
$output,
|
||||
$creates
|
||||
) {
|
||||
|
||||
Exec { path => '/usr/bin:/bin' }
|
||||
|
||||
$cwd = '/usr/local/src'
|
||||
|
||||
include wget
|
||||
|
||||
exec { 'download-phantomjs':
|
||||
cwd => $cwd,
|
||||
command => "wget -q ${url} -O ${output}",
|
||||
creates => "${cwd}/${output}",
|
||||
timeout => 120,
|
||||
require => Class['wget']
|
||||
}
|
||||
|
||||
$src = "${cwd}/phantomjs"
|
||||
|
||||
exec { 'extract-phantomjs':
|
||||
cwd => $cwd,
|
||||
command => "mkdir -p phantomjs && tar --no-same-owner \
|
||||
--no-same-permissions -xjf ${output} -C ${src} \
|
||||
--strip-components 1",
|
||||
creates => $src,
|
||||
require => Exec['download-phantomjs']
|
||||
}
|
||||
|
||||
file { 'install-phantomjs':
|
||||
path => $creates,
|
||||
source => $src,
|
||||
recurse => true,
|
||||
require => Exec['extract-phantomjs']
|
||||
}
|
||||
|
||||
file { 'link-phantomjs-bin':
|
||||
ensure => "${creates}/bin/phantomjs",
|
||||
path => '/usr/local/bin/phantomjs'
|
||||
}
|
||||
}
|
|
@ -1,20 +0,0 @@
|
|||
# Class: wget
|
||||
#
|
||||
# This class installs wget.
|
||||
#
|
||||
# Parameters:
|
||||
#
|
||||
# Actions:
|
||||
#
|
||||
# Requires:
|
||||
#
|
||||
# Sample Usage:
|
||||
#
|
||||
# include wget
|
||||
#
|
||||
class wget {
|
||||
|
||||
package { 'wget':
|
||||
ensure => installed,
|
||||
}
|
||||
}
|
|
@ -15,93 +15,36 @@ else
|
|||
end
|
||||
|
||||
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
|
||||
# All Vagrant configuration is done here. The most common configuration
|
||||
# options are documented and commented below. For a complete reference,
|
||||
# please see the online documentation at vagrantup.com.
|
||||
|
||||
# Every Vagrant virtual environment requires a box to build off of.
|
||||
config.vm.box = "centos-6.4-x64-vbox"
|
||||
|
||||
# The url from where the 'config.vm.box' box will be fetched if it
|
||||
# doesn't already exist on the user's system.
|
||||
config.vm.box_url = "http://vagrant-boxes.icinga.org/centos-64-x64-vbox4212.box"
|
||||
|
||||
# Create a forwarded port mapping which allows access to a specific port
|
||||
# within the machine from a port on the host machine. In the example below,
|
||||
# accessing "localhost:8080" will access port 80 on the guest machine.
|
||||
config.vm.network :forwarded_port, guest: 80, host: 8080,
|
||||
# Port collision auto-correction must be manually enabled for each forwarded port,
|
||||
# since it is often surprising when it occurs and can lead the Vagrant user to
|
||||
# think that the port wasn't properly forwarded. During a vagrant up or vagrant reload,
|
||||
# Vagrant will output information about any collisions detections and auto corrections made,
|
||||
# so you can take notice and act accordingly.
|
||||
config.vm.network "forwarded_port", guest: 80, host: 8080,
|
||||
auto_correct: true
|
||||
|
||||
# Create a private network, which allows host-only access to the machine
|
||||
# using a specific IP.
|
||||
# config.vm.network :private_network, ip: "192.168.33.10"
|
||||
config.vm.provision :shell, :path => ".puppet/manifests/puppet.sh"
|
||||
|
||||
# Create a public network, which generally matched to bridged network.
|
||||
# Bridged networks make the machine appear as another physical device on
|
||||
# your network.
|
||||
# config.vm.network :public_network
|
||||
config.vm.provider :virtualbox do |v, override|
|
||||
override.vm.box = "puppetlabs/centos-6.5-64-puppet"
|
||||
|
||||
# If true, then any SSH connections made will enable agent forwarding.
|
||||
# Default value: false
|
||||
# config.ssh.forward_agent = true
|
||||
|
||||
# Share an additional folder to the guest VM. The first argument is
|
||||
# the path on the host to the actual folder. The second argument is
|
||||
# the path on the guest to mount the folder. And the optional third
|
||||
# argument is a set of non-required options.
|
||||
config.vm.synced_folder "./var/log", "/vagrant/var/log"
|
||||
|
||||
# Provider-specific configuration so you can fine-tune various
|
||||
# backing providers for Vagrant. These expose provider-specific options.
|
||||
# Example for VirtualBox:
|
||||
#
|
||||
# config.vm.provider :virtualbox do |vb|
|
||||
# # Don't boot with headless mode
|
||||
# vb.gui = true
|
||||
#
|
||||
# # Use VBoxManage to customize the VM. For example to change memory:
|
||||
# vb.customize ["modifyvm", :id, "--memory", "1024"]
|
||||
# end
|
||||
#
|
||||
# View the documentation for the provider you're using for more
|
||||
# information on available options.
|
||||
config.vm.provider "virtualbox" do |vb|
|
||||
vb.customize ["setextradata", :id, "VBoxInternal2/SharedFoldersEnableSymlinksCreate//vagrant/config", "1"]
|
||||
vb.customize ["modifyvm", :id, "--memory", "1024"]
|
||||
v.customize ["modifyvm", :id, "--memory", "1024"]
|
||||
end
|
||||
|
||||
config.vm.provider :parallels do |p, override|
|
||||
override.vm.box = "parallels/centos-6.5"
|
||||
|
||||
p.name = "Icinga Web 2 Development"
|
||||
|
||||
# Update Parallels Tools automatically
|
||||
p.update_guest_tools = true
|
||||
|
||||
# Set power consumption mode to "Better Performance"
|
||||
p.optimize_power_consumption = false
|
||||
|
||||
p.memory = 1024
|
||||
p.cpus = 2
|
||||
end
|
||||
|
||||
# Enable provisioning with Puppet stand alone. Puppet manifests
|
||||
# are contained in a directory path relative to this Vagrantfile.
|
||||
# You will need to create the manifests directory and a manifest in
|
||||
# the file base.pp in the manifests_path directory.
|
||||
#
|
||||
# An example Puppet manifest to provision the message of the day:
|
||||
#
|
||||
# # group { "puppet":
|
||||
# # ensure => "present",
|
||||
# # }
|
||||
# #
|
||||
# # File { owner => 0, group => 0, mode => 0644 }
|
||||
# #
|
||||
# # file { '/etc/motd':
|
||||
# # content => "Welcome to your Vagrant-built virtual machine!
|
||||
# # Managed by Puppet.\n"
|
||||
# # }
|
||||
#
|
||||
# config.vm.provision :puppet do |puppet|
|
||||
# puppet.manifests_path = "manifests"
|
||||
# puppet.manifest_file = "init.pp"
|
||||
# end
|
||||
config.vm.provision :puppet do |puppet|
|
||||
puppet.module_path = ".vagrant-puppet/modules"
|
||||
puppet.manifests_path = ".vagrant-puppet/manifests"
|
||||
# puppet.options = "-v -d"
|
||||
puppet.hiera_config_path = ".puppet/hiera/hiera.yaml"
|
||||
puppet.module_path = [ ".puppet/modules", ".puppet/profiles" ]
|
||||
puppet.manifests_path = ".puppet/manifests"
|
||||
puppet.manifest_file = "site.pp"
|
||||
end
|
||||
|
||||
config.vm.provision :shell, :path => ".vagrant-puppet/manifests/finalize.sh"
|
||||
end
|
||||
|
|
|
@ -1,27 +0,0 @@
|
|||
# -*- mode: ruby -*-
|
||||
# vi: set ft=ruby :
|
||||
|
||||
Vagrant.configure("2") do |config|
|
||||
config.vm.box = "parallels/centos-6.5"
|
||||
|
||||
config.vm.network "forwarded_port", guest: 80, host: 8080,
|
||||
auto_correct: true
|
||||
|
||||
config.vm.provider "parallels" do |v|
|
||||
v.name = "Icinga Web 2 Development"
|
||||
# Update Parallels Tools automatically
|
||||
v.update_guest_tools = true
|
||||
# Set power consumption mode to "Better Performance"
|
||||
v.optimize_power_consumption = false
|
||||
v.memory = 1024
|
||||
v.cpus = 2
|
||||
end
|
||||
|
||||
config.puppet_install.puppet_version = :latest
|
||||
|
||||
config.vm.provision :puppet do |puppet|
|
||||
puppet.module_path = ".vagrant-puppet/modules"
|
||||
puppet.manifests_path = ".vagrant-puppet/manifests"
|
||||
# puppet.options = "-v -d"
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue