From c1c3b112459f995afdaae9cc9aa415ea68788596 Mon Sep 17 00:00:00 2001 From: mh Date: Wed, 2 Jan 2013 18:48:49 +0100 Subject: make trocla an optional dependency --- manifests/server.pp | 24 ++++++++++++++++-------- manifests/server/munin/default.pp | 9 ++++----- manifests/server/nagios.pp | 2 +- 3 files changed, 21 insertions(+), 14 deletions(-) (limited to 'manifests') diff --git a/manifests/server.pp b/manifests/server.pp index bc49100..f802935 100644 --- a/manifests/server.pp +++ b/manifests/server.pp @@ -1,13 +1,16 @@ # manage a mysql server class mysql::server ( - $manage_shorewall = false, - $manage_munin = false, - $manage_nagios = false, - $backup_cron = false, - $optimize_cron = false, - $backup_dir = '/var/backups/mysql', - $manage_backup_dir = true, - $nagios_notcp = false + $root_password, + $manage_shorewall = false, + $manage_munin = false, + $munin_password = 'absent', + $manage_nagios = false, + $nagios_password_hash = 'absent', + $backup_cron = false, + $optimize_cron = false, + $backup_dir = '/var/backups/mysql', + $manage_backup_dir = true, + $nagios_notcp = false ) { case $::operatingsystem { gentoo: { include mysql::server::gentoo } @@ -17,6 +20,9 @@ class mysql::server ( } if $manage_munin and $::mysql_exists == 'true' { + if $munin_password == 'absent' { + fail("need to set the munin password") + } case $::operatingsystem { debian: { include mysql::server::munin::debian } default: { include mysql::server::munin::default } @@ -24,6 +30,8 @@ class mysql::server ( } if $manage_nagios and $::mysql_exists == 'true' { + if $nagios_password_hash == 'absent' { + fail("need to set the nagios password hash") include mysql::server::nagios } diff --git a/manifests/server/munin/default.pp b/manifests/server/munin/default.pp index 11609d2..91cd5fe 100644 --- a/manifests/server/munin/default.pp +++ b/manifests/server/munin/default.pp @@ -1,7 +1,7 @@ # manage plugins class mysql::server::munin::default { mysql_user{'munin@localhost': - password_hash => trocla("mysql_munin_${::fqdn}",'mysql','length: 32'), + password_hash => mysql_password($mysql::server::munin_password), require => Exec['mysql_set_rootpw'], } @@ -10,18 +10,17 @@ class mysql::server::munin::default { require => Mysql_user['munin@localhost'], } - $munin_mysql_password = trocla("mysql_munin_${::fqdn}",'plain', 'length: 32') munin::plugin { [mysql_queries, mysql_slowqueries]: - config => "env.mysqlopts --user=munin --password='${munin_mysql_password}' -h localhost", + config => "env.mysqlopts --user=munin --password='${mysql::server::munin_password}' -h localhost", require => Mysql_grant['munin@localhost']; [mysql_bytes, mysql_threads]: - config => "env.mysqlopts --user=munin --password=${munin_mysql_password} -h localhost", + config => "env.mysqlopts --user=munin --password=${mysql::server::munin_password} -h localhost", require => Mysql_grant['munin@localhost']; } Munin::Plugin::Deploy{ - config => "env.mysqlopts --user=munin --password='${munin_mysql_password}' -h localhost", + config => "env.mysqlopts --user=munin --password='${mysql::server::munin_password}' -h localhost", require => Mysql_grant['munin@localhost'], } munin::plugin::deploy{ diff --git a/manifests/server/nagios.pp b/manifests/server/nagios.pp index 944e0dd..34bb086 100644 --- a/manifests/server/nagios.pp +++ b/manifests/server/nagios.pp @@ -13,7 +13,7 @@ class mysql::server::nagios { } mysql_user{$nagios_mysql_user: - password_hash => trocla("mysql_nagios_${::fqdn}",'mysql','length: 32'), + password_hash => $mysql::server::nagios_password_hash, require => Package['mysql'], } -- cgit v1.2.3