diff options
author | mh <mh@immerda.ch> | 2013-12-05 09:53:51 +0100 |
---|---|---|
committer | mh <mh@immerda.ch> | 2013-12-05 09:53:51 +0100 |
commit | f7a31af7c4c44ec11ff1fc61c466c4476e9f093c (patch) | |
tree | 974c27c8289cca03c294cd94db266e332d13f1bb /manifests | |
parent | e968708b7ad8420453baf085862edc2c92b52c9b (diff) |
make it possible to consume an external database
Diffstat (limited to 'manifests')
-rw-r--r-- | manifests/master/dashboard.pp | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/manifests/master/dashboard.pp b/manifests/master/dashboard.pp index df8bcf8..e3d56b5 100644 --- a/manifests/master/dashboard.pp +++ b/manifests/master/dashboard.pp @@ -1,21 +1,32 @@ +# simple installation of a puppet dashboard class puppet::master::dashboard( $settings = {}, $service = true, + $mysql_host = '127.0.0.1', $mysql_password, ) { package{'puppet-dashboard': ensure => installed, - } -> mysql::default_database{ - 'dashboard': - password => mysql_password($mysql_password), - host => '127.0.0.1'; - } -> file{ + } + + if $mysql_host == '127.0.0.1' { + mysql::default_database{ + 'dashboard': + password => mysql_password($mysql_password), + host => '127.0.0.1', + require => Package['puppet-dashboard'], + before => File['/usr/share/puppet-dashboard/config/database.yml'], + } + } + + file{ '/usr/share/puppet-dashboard/config/database.yml': content => template('puppet/master/dashboard/database.yml.erb'), owner => root, group => 'puppet-dashboard', - mode => '0640'; + mode => '0640', + require => Package['puppet-dashboard']; '/usr/share/puppet-dashboard/config/settings.yml': content => template('puppet/master/dashboard/settings.yml.erb'), owner => root, @@ -33,7 +44,7 @@ class puppet::master::dashboard( } file{'/etc/cron.daily/puppet-dashboard_cleanup': - content => "#/bin/bash + content => "#/bin/bash cd /usr/share/puppet-dashboard RAILS_ENV=production /usr/bin/rake reports:prune upto=1 unit=mon >> /usr/share/puppet-dashboard/log/cron.log RAILS_ENV=production /usr/bin/rake reports:prune:orphaned >> /usr/share/puppet-dashboard/log/cron.log @@ -47,8 +58,8 @@ RAILS_ENV=production /usr/bin/rake db:raw:optimize >> /usr/share/puppet-dashboar service{'puppet-dashboard': } if $service { Service['puppet-dashboard']{ - ensure => running, - enable => true, + ensure => running, + enable => true, subscribe => File['/usr/share/puppet-dashboard/config/database.yml','/usr/share/puppet-dashboard/config/settings.yml'], } } else { |