接着上面的puppet安装一文,虽然puppet会很努力的工作,但还有个问题,我们想了解puppet节点的运行情况,也就是回馈,因为编写puppet语法规则难免出错。但是report目录下的yaml 文件又不具有可读性,客户端很多则邮件又会被淹没,于是这就有了dashboard。
安装dashboard
1
2
|
yum install puppetlabs-release
yum install puppet-dashboard mysql-server ruby-mysql
|
1
2
3
4
5
6
|
# service mysqld start # mysql -u root -p mysql> CREATE DATABASE dashboard_production CHARACTER SET utf8; >CREATE USER 'dashboard' @ 'localhost' IDENTIFIED BY 'dashboard' ;
>GRANT ALL PRIVILEGES ON dashboard_production.* TO 'dashboard' @ 'localhost' ;
> flush privileges; |
编辑/usr/share/puppet-dashboard/config/database.yml,修改如下
1
2
3
4
5
6
|
production: database: dashboard_production
username: dashboard
password: dashboard
encoding: utf8
adapter: mysql
|
1
2
3
4
|
# cd /usr/share/puppet-dashboard/ # rake gems:refresh_specs # rake RAILS_ENV=production db:create # rake RAILS_ENV=production db:migrate |
启动puppet-dashboard
1
2
|
chmod 666 /usr/share/puppet-dashboard/log/production .log
service puppet-dashboard start |
这样,puppet-dashboard 就会监听在本地3000端口,使用的是ruby自带的http服务器webrick,可以通过web浏览了。
apache作为前端
配置httpd虚拟主机
1
|
cp /usr/share/puppet-dashboard/ext/passenger/dashboard-vhost .conf /etc/httpd/conf .d /dashboard .conf
|
配置文件同样是给debian/ubuntu 用的,需要做一些修改
-
/var/lib/gems/1.8/gems/passenger-2.2.11/ext/apache2/mod_passenger.so
-
/usr/lib64/httpd/modules/mod_passenger.so
-
/var/lib/gems/1.8/gems/passenger-2.2.11
-
/usr/lib/ruby/gems/1.8/gems/passenger-3.0.12
-
# LoadModule passenger_module /usr/lib64/httpd/modules/mod_passenger.so
-
# PassengerRoot /usr/lib/ruby/gems/1.8/gems/passenger-3.0.12
-
# PassengerRuby /usr/bin/ruby
-
# you may want to tune these settings
-
PassengerHighPerformance on
-
PassengerMaxPoolSize 12
-
PassengerPoolIdleTime 1500
-
# PassengerMaxRequests 1000
-
PassengerStatThrottleRate 120
-
RailsAutoDetect On
-
<VirtualHost *:80>
-
ServerName dashboard.puppet.test.org
-
DocumentRoot /usr/share/puppet-dashboard/public/
-
<Directory /usr/share/puppet-dashboard/public/>
-
Options None
-
Order allow,deny
-
allow from all
-
</Directory>
-
ErrorLog /var/log/httpd/dashboard.puppet.test.org_error.log
-
LogLevel warn
-
CustomLog /var/log/httpd/dashboard.puppet.test.org_access.log combined
-
ServerSignature On
-
service httpd restart
-
[agent]
-
report = true
-
[master]
-
reports = store,http
-
reporturl = http://dashboard.puppet.test.org:80/reports
-
#rake RAILS_ENV=production reports:import REPORT_DIR=/var/lib/puppet/
-
cp /usr/share/puppet-dashboard/ext/puppet/puppet_dashboard.rb /var/lib/puppet/reports/
-
# /etc/init.d/puppet-dashboard start
-
# /etc/init.d/puppet-dashboard-workers start