puppet项目计划之(puppet dashboard图形管理篇)
在服务端安装puppet的dashboard
1、 安装mysql
2、
yuminstall-y mysql mysql-devel mysql-server
3、 优化mysql设置
编辑 /etc/my.cnf, 在[mysqld]字段,增加最后一行
cat/etc/my.cnf
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
# Disabling symbolic-links is recommendedto prevent assorted security risks
symbolic-links=0
max_allowed_packet = 32M
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
4、 启动服务
/etc/init.d/mysqldstart
chkconfig mysqld on
5、设置mysql密码,我这里使用是密码是password
Mysqladmin �Cu root password `password`
创建一个dashboard数据库
6、mysql -uroot -p123456 <<EOF
CREATE DATABASE dashboardCHARACTER SET utf8;
CREATE USER'dashboard'@'localhost'IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ONdashboard.* TO 'dashboard'@'localhost';
FLUSH PRIVILEGES;
EOF
Passenger+Apache+Dashboard
这是让Apache支持ruby,由于Passenger不在centos官方源里,因此要添加epel的源
1、wgethttps://dl.fedoraproject.org/pub/epel/5/i386/epel-release-5-3.noarch.rpm
2、rpm -ivhepel-release-5-3.noarch.rpm
3、编写yum源以便找到mod_passenger puppet-dashboard
[geek-puppet]
name=Geek-puppet Repo
baseurl=http://download.longgeek.com/Puppet_for_rhel6.2/
gpgcheck=0
4、
yuminstall mod_passenger puppet-dashboard
5、 配置Dashboard
vi/usr/share/puppet-dashboard/config/database.yml
production:
database: dashboard
username: dashboard
password: password
encoding: utf8
adapter: mysql
6、 修改时区
vi/usr/share/puppet-dashboard/config/environment.rb
#config.time_zone= 'UTC'
config.time_zone= 'Beijing'
7、 配置Apache
我们需要整合Passenger和apache
vim/etc/httpd/conf.d/passenger.conf
LoadModule passenger_modulemodules/mod_passenger.so
<IfModulemod_passenger.c>
PassengerRoot/usr/share/rubygems/gems/passenger-3.0.17
PassengerRuby /usr/bin/ruby
PassengerHighPerformance on
PassengerMaxPoolSize 12
PassengerPoolIdleTime 1500
PassengerStatThrottleRate 120
RailsAutoDetect On
</IfModule>
<VirtualHost *:80>
ServerName master.kylinyunwei.com
DocumentRoot "/usr/share/puppet-dashboard/public/"
<Directory"/usr/share/puppet-dashboard/public/">
Options None
AllowOverride AuthConfig
Order allow,deny
allow from all
</Directory>
ErrorLog /var/log/httpd/master.kylinyunwei.com_error.log
LogLevel warn
CustomLog/var/log/httpd/master.kylinyunwei.com_access.log combined
ServerSignature On
</VirtualHost>
8、 重启服务
[root@master ~]# servicehttpd restart
停止 httpd: [确定]
正在启动 httpd: [确定]
配置puppet
让Dashboard使用Reports,现在默认agent是已经启用Report的功能,所以你就不需要设置agent,你只需要设置Server端就可以
1、vi/etc/puppet/puppet.conf
[master]
reports = store, http
reporturl = http://master.canghai.com:80/reports/upload
2、重启puppetmaster 服务
/etc/init.d/puppetmasterrestart
3
、
这时候就可以直接用 http://ip 访问puppet Dashboard
4、导入报告
cd/usr/share/puppet-dashboard
[root@masterpuppet-dashboard]# rake RAILS_ENV=production reports:import
(in/usr/share/puppet-dashboard)
Unable to read the packagingrepo info from ext/build_defaults.yaml
Importing 176 reports from/var/lib/puppet/reports/ in the background
Importing: 100%|#######################################################################################################################|Time: 00:00:04
176 of 176 reports queued
5、执行导入的reports
cd/usr/share/puppet-dashboard
rake jobs:workRAILS_ENV="production"
[root@masterpuppet-dashboard]# rake jobs:work RAILS_ENV="production"
(in /usr/share/puppet-dashboard)
Unable to readthe packaging repo info from ext/build_defaults.yaml
[Worker(host:master.kylinyunwei.compid:19114)] Starting job worker
[Worker(host:master.kylinyunwei.compid:19114)] Report.create_from_yaml_file completed after 0.3231
[Worker(host:master.kylinyunwei.compid:19114)] 1 jobs processed at 2.8080 j/s, 0 failed ...
6、查看结果
7、成功报告