Merge branch 'master' of bitbucket.org:tmakinen/puppet

This commit is contained in:
Ossi Salmi 2013-05-13 18:46:19 +03:00
commit 036bb38d78
11 changed files with 157 additions and 18 deletions

View file

@ -1,7 +1,34 @@
#!/bin/sh
# compact database
echo "vacuum;" | sqlite3 /srv/bacula/bacula.db
umask 077
# dump database to file
echo ".dump" | sqlite3 /srv/bacula/bacula.db > /srv/bacula/bacula.sql
# read settings
eval `dbcheck -B -c /etc/bacula/bacula-dir.conf`
backupfile="${working_dir}/bacula.sql"
case $db_type in
MySQL)
cat <<EOF > ${working_dir}/my.cnf
[client]
host="${db_address}"
user="${db_user}"
password="${db_password}"
EOF
MYSQL_HOME=${working_dir} mysqldump ${db_name} > ${backupfile}
rm ${working_dir}/my.cnf
;;
PostgreSQL)
echo "${db_password}" > ${working_dir}/.pgpass
HOME=${working_dir} pg_dump -c ${db_address} -U ${db_user} \
${db_name} > ${backupfile}
rm ${working_dir}/.pgpass
;;
SQLite)
echo "vacuum;" | sqlite3 ${working_dir}/bacula.db
echo ".dump" | sqlite3 ${working_dir}/bacula.db > ${backupfile}
;;
*)
echo "ERR: No dump support for '${db_type}' database"
;;
esac

View file

@ -3,7 +3,7 @@ FileSet {
Name = "Catalog"
Include {
Options {
signature = MD5
signature = SHA1
}
File = "/srv/bacula/bacula.sql"
}

View file

@ -4,6 +4,9 @@ FileSet {
Include {
Options {
signature = SHA1
noatime = yes
aclsupport = yes
xattrsupport = yes
onefs = yes
}
File = "|sh -c 'mount | awk \"{ if (/^\\/dev\\//) { print \\$3} }\"'"

View file

@ -144,6 +144,13 @@ class bacula::director($password=undef,
}
}
"mysql": {
require mysql::client
if !$dbpassword {
fail("\$dbpassword is required for bacula::director when using '${dbadapter} database")
}
}
"postgresql": {
require postgresql::client
if !$dbpassword {
fail("\$dbpassword is required for bacula::director when using '${dbadapter} database")
}
@ -155,8 +162,9 @@ class bacula::director($password=undef,
package { "bacula-director":
name => $dbadapter ? {
"sqlite" => "bacula-director-sqlite",
"mysql" => "bacula-director-mysql",
"mysql" => "bacula-director-mysql",
"postgresql" => "bacula-director-postgresql",
"sqlite" => "bacula-director-sqlite",
},
ensure => installed,
before => Class["bacula::certificates"],
@ -400,6 +408,10 @@ class bacula::storage($password = undef) {
define bacula::device($device, $media) {
include bacula::storage
require smart
package { "mtx":
ensure => installed,
}
file { "/etc/bacula/bacula-sd.d/${name}.conf":
ensure => present,
@ -464,6 +476,11 @@ class bacula::web($htaccess,
before => File["/usr/local/src/bacula-web.tar.gz"],
}
}
"postgresql": {
class { "php::pgsql":
before => File["/usr/local/src/bacula-web.tar.gz"],
}
}
"sqlite": { }
default: {
fail("Invalid \$dbadapter '${dbadapter}' in bacula::web")

View file

@ -19,7 +19,11 @@ $config[0]['host'] = '<%= @dbserver %>';
$config[0]['login'] = '<%= @dbuser %>';
$config[0]['password'] = '<%= @dbpassword %>';
$config[0]['db_name'] = '<%= @dbname %>';
<% if @dbadapter == 'postgresql' -%>
$config[0]['db_type'] = 'pgsql';
<% else -%>
$config[0]['db_type'] = 'mysql';
<% end -%>
<% end -%>
?>

View file

@ -7,4 +7,6 @@ Device {
AlwaysOpen = no;
RemovableMedia = yes;
RandomAccess = no;
Alert Command = "sh -c 'tapeinfo -f %c | grep TapeAlert | cat'"
Alert Command = "sh -c 'smartctl -H -l error %c'"
}

View file

@ -148,6 +148,13 @@ define command{
}
# 'check_ldap' command definition
define command{
command_name check_ldap
command_line $USER1$/check_ldap -H $HOSTADDRESS$ -b $ARG1$
}
# 'check_ssh' command definition
define command{
command_name check_ssh
@ -155,6 +162,13 @@ define command{
}
# 'check_dig' command definition
define command{
command_name check_dig
command_line $USER1$/check_dig -H $HOSTADDRESS$ -l $ARG1$
}
# 'check_dhcp' command definition
define command{
command_name check_dhcp

View file

@ -40,6 +40,23 @@ class nagios::target($parent=undef) {
}
# Configure dig service target.
#
# === Parameters
#
# $query:
# Address to query from DNS server. Defaults to localhost.
#
class nagios::target::dns ($query="localhost") inherits nagios::target {
@@nagios::service { "${::homename}_dig":
command => "check_dig!${query}",
description => "DNS",
}
}
# Configure ssh service target.
#
class nagios::target::ssh inherits nagios::target {
@ -88,6 +105,30 @@ class nagios::target::imaps inherits nagios::target {
}
# Configure ldap service target.
#
class nagios::target::ldap inherits nagios::target {
@@nagios::service { "${::homename}_ldap":
command => "check_ldap!${ldap_basedn}",
description => "LDAP",
}
}
# Configure ldaps service target.
#
class nagios::target::ldaps inherits nagios::target {
@@nagios::service { "${::homename}_ldaps":
command => "check_ldap!${ldap_basedn} -p 636",
description => "LDAPs",
}
}
# Configure smtp service target.
#
class nagios::target::smtp inherits nagios::target {

View file

@ -32,6 +32,17 @@ class php::mysql {
}
# Install PostgreSQL support to PHP
#
class php::pgsql {
package { "php-pgsql":
ensure => installed,
}
}
# Install PDO database abstraction support to PHP
#
class php::pdo {

View file

@ -46,26 +46,39 @@ class postgresql::server($datadir="/srv/pgsql") {
if $datadir != "/srv/pgsql" {
file { $datadir:
ensure => directory,
mode => "0700",
owner => "postgres",
group => "postgres",
ensure => directory,
mode => "0700",
owner => "postgres",
group => "postgres",
seltype => "postgresql_db_t",
require => Package["postgresql"],
}
file { "/srv/pgsql":
ensure => link,
target => $datadir,
owner => "root",
group => "root",
seltype => "postgresql_db_t",
require => File[$datadir],
}
selinux::manage_fcontext { "${datadir}(/.*)?":
type => "postgresql_db_t",
before => File[$datadir],
}
} else {
file { "/srv/pgsql":
ensure => directory,
mode => "0700",
owner => "postgres",
group => "postgres",
ensure => directory,
mode => "0700",
owner => "postgres",
group => "postgres",
seltype => "postgresql_db_t",
require => Package["postgresql"],
}
}
selinux::manage_fcontext { "/srv/pgsql(/.*)?":
type => "postgresql_db_t",
before => File["/srv/pgsql"],
}
package { "postgresql-server":
ensure => installed,

View file

@ -1,11 +1,18 @@
# Install S.M.A.R.T. tools
class smart {
package { "smartmontools":
ensure => installed
}
}
# Enable S.M.A.R.T. monitoring daemon
#
class smart::daemon {
package { "smartmontools":
ensure => installed,
}
require smart
service { "smartd":
ensure => running,