Merge branch 'master' of bitbucket.org:tmakinen/puppet
This commit is contained in:
commit
036bb38d78
11 changed files with 157 additions and 18 deletions
|
@ -1,7 +1,34 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
# compact database
|
umask 077
|
||||||
echo "vacuum;" | sqlite3 /srv/bacula/bacula.db
|
|
||||||
|
|
||||||
# dump database to file
|
# read settings
|
||||||
echo ".dump" | sqlite3 /srv/bacula/bacula.db > /srv/bacula/bacula.sql
|
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
|
||||||
|
|
|
@ -3,7 +3,7 @@ FileSet {
|
||||||
Name = "Catalog"
|
Name = "Catalog"
|
||||||
Include {
|
Include {
|
||||||
Options {
|
Options {
|
||||||
signature = MD5
|
signature = SHA1
|
||||||
}
|
}
|
||||||
File = "/srv/bacula/bacula.sql"
|
File = "/srv/bacula/bacula.sql"
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,9 @@ FileSet {
|
||||||
Include {
|
Include {
|
||||||
Options {
|
Options {
|
||||||
signature = SHA1
|
signature = SHA1
|
||||||
|
noatime = yes
|
||||||
|
aclsupport = yes
|
||||||
|
xattrsupport = yes
|
||||||
onefs = yes
|
onefs = yes
|
||||||
}
|
}
|
||||||
File = "|sh -c 'mount | awk \"{ if (/^\\/dev\\//) { print \\$3} }\"'"
|
File = "|sh -c 'mount | awk \"{ if (/^\\/dev\\//) { print \\$3} }\"'"
|
||||||
|
|
|
@ -144,6 +144,13 @@ class bacula::director($password=undef,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
"mysql": {
|
"mysql": {
|
||||||
|
require mysql::client
|
||||||
|
if !$dbpassword {
|
||||||
|
fail("\$dbpassword is required for bacula::director when using '${dbadapter} database")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
"postgresql": {
|
||||||
|
require postgresql::client
|
||||||
if !$dbpassword {
|
if !$dbpassword {
|
||||||
fail("\$dbpassword is required for bacula::director when using '${dbadapter} database")
|
fail("\$dbpassword is required for bacula::director when using '${dbadapter} database")
|
||||||
}
|
}
|
||||||
|
@ -155,8 +162,9 @@ class bacula::director($password=undef,
|
||||||
|
|
||||||
package { "bacula-director":
|
package { "bacula-director":
|
||||||
name => $dbadapter ? {
|
name => $dbadapter ? {
|
||||||
"sqlite" => "bacula-director-sqlite",
|
"mysql" => "bacula-director-mysql",
|
||||||
"mysql" => "bacula-director-mysql",
|
"postgresql" => "bacula-director-postgresql",
|
||||||
|
"sqlite" => "bacula-director-sqlite",
|
||||||
},
|
},
|
||||||
ensure => installed,
|
ensure => installed,
|
||||||
before => Class["bacula::certificates"],
|
before => Class["bacula::certificates"],
|
||||||
|
@ -400,6 +408,10 @@ class bacula::storage($password = undef) {
|
||||||
define bacula::device($device, $media) {
|
define bacula::device($device, $media) {
|
||||||
|
|
||||||
include bacula::storage
|
include bacula::storage
|
||||||
|
require smart
|
||||||
|
package { "mtx":
|
||||||
|
ensure => installed,
|
||||||
|
}
|
||||||
|
|
||||||
file { "/etc/bacula/bacula-sd.d/${name}.conf":
|
file { "/etc/bacula/bacula-sd.d/${name}.conf":
|
||||||
ensure => present,
|
ensure => present,
|
||||||
|
@ -464,6 +476,11 @@ class bacula::web($htaccess,
|
||||||
before => File["/usr/local/src/bacula-web.tar.gz"],
|
before => File["/usr/local/src/bacula-web.tar.gz"],
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
"postgresql": {
|
||||||
|
class { "php::pgsql":
|
||||||
|
before => File["/usr/local/src/bacula-web.tar.gz"],
|
||||||
|
}
|
||||||
|
}
|
||||||
"sqlite": { }
|
"sqlite": { }
|
||||||
default: {
|
default: {
|
||||||
fail("Invalid \$dbadapter '${dbadapter}' in bacula::web")
|
fail("Invalid \$dbadapter '${dbadapter}' in bacula::web")
|
||||||
|
|
|
@ -19,7 +19,11 @@ $config[0]['host'] = '<%= @dbserver %>';
|
||||||
$config[0]['login'] = '<%= @dbuser %>';
|
$config[0]['login'] = '<%= @dbuser %>';
|
||||||
$config[0]['password'] = '<%= @dbpassword %>';
|
$config[0]['password'] = '<%= @dbpassword %>';
|
||||||
$config[0]['db_name'] = '<%= @dbname %>';
|
$config[0]['db_name'] = '<%= @dbname %>';
|
||||||
|
<% if @dbadapter == 'postgresql' -%>
|
||||||
|
$config[0]['db_type'] = 'pgsql';
|
||||||
|
<% else -%>
|
||||||
$config[0]['db_type'] = 'mysql';
|
$config[0]['db_type'] = 'mysql';
|
||||||
|
<% end -%>
|
||||||
<% end -%>
|
<% end -%>
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -7,4 +7,6 @@ Device {
|
||||||
AlwaysOpen = no;
|
AlwaysOpen = no;
|
||||||
RemovableMedia = yes;
|
RemovableMedia = yes;
|
||||||
RandomAccess = no;
|
RandomAccess = no;
|
||||||
|
Alert Command = "sh -c 'tapeinfo -f %c | grep TapeAlert | cat'"
|
||||||
|
Alert Command = "sh -c 'smartctl -H -l error %c'"
|
||||||
}
|
}
|
||||||
|
|
|
@ -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
|
# 'check_ssh' command definition
|
||||||
define command{
|
define command{
|
||||||
command_name check_ssh
|
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
|
# 'check_dhcp' command definition
|
||||||
define command{
|
define command{
|
||||||
command_name check_dhcp
|
command_name check_dhcp
|
||||||
|
|
|
@ -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.
|
# Configure ssh service target.
|
||||||
#
|
#
|
||||||
class nagios::target::ssh inherits nagios::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.
|
# Configure smtp service target.
|
||||||
#
|
#
|
||||||
class nagios::target::smtp inherits nagios::target {
|
class nagios::target::smtp inherits nagios::target {
|
||||||
|
|
|
@ -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
|
# Install PDO database abstraction support to PHP
|
||||||
#
|
#
|
||||||
class php::pdo {
|
class php::pdo {
|
||||||
|
|
|
@ -46,26 +46,39 @@ class postgresql::server($datadir="/srv/pgsql") {
|
||||||
|
|
||||||
if $datadir != "/srv/pgsql" {
|
if $datadir != "/srv/pgsql" {
|
||||||
file { $datadir:
|
file { $datadir:
|
||||||
ensure => directory,
|
ensure => directory,
|
||||||
mode => "0700",
|
mode => "0700",
|
||||||
owner => "postgres",
|
owner => "postgres",
|
||||||
group => "postgres",
|
group => "postgres",
|
||||||
|
seltype => "postgresql_db_t",
|
||||||
|
require => Package["postgresql"],
|
||||||
}
|
}
|
||||||
file { "/srv/pgsql":
|
file { "/srv/pgsql":
|
||||||
ensure => link,
|
ensure => link,
|
||||||
target => $datadir,
|
target => $datadir,
|
||||||
owner => "root",
|
owner => "root",
|
||||||
group => "root",
|
group => "root",
|
||||||
|
seltype => "postgresql_db_t",
|
||||||
require => File[$datadir],
|
require => File[$datadir],
|
||||||
}
|
}
|
||||||
|
selinux::manage_fcontext { "${datadir}(/.*)?":
|
||||||
|
type => "postgresql_db_t",
|
||||||
|
before => File[$datadir],
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
file { "/srv/pgsql":
|
file { "/srv/pgsql":
|
||||||
ensure => directory,
|
ensure => directory,
|
||||||
mode => "0700",
|
mode => "0700",
|
||||||
owner => "postgres",
|
owner => "postgres",
|
||||||
group => "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":
|
package { "postgresql-server":
|
||||||
ensure => installed,
|
ensure => installed,
|
||||||
|
|
|
@ -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
|
# Enable S.M.A.R.T. monitoring daemon
|
||||||
#
|
#
|
||||||
class smart::daemon {
|
class smart::daemon {
|
||||||
|
|
||||||
package { "smartmontools":
|
require smart
|
||||||
ensure => installed,
|
|
||||||
}
|
|
||||||
|
|
||||||
service { "smartd":
|
service { "smartd":
|
||||||
ensure => running,
|
ensure => running,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue