Puppet安装dashboard
安装依赖包
- [root@master ~]# sudo yum install -y mysql mysql-devel mysql-server ruby ruby-devel ruby-irb ruby-mysql ruby-rdoc ruby-ri
启动mysql并设置开机启动
- [root@master ~]# service mysqld start
- [root@master ~]# chkconfig mysqld on
下载并安装rubygems
- [root@master ~]# wget http://production.cf.rubygems.org/rubygems/rubygems-1.3.5.tgz
- [root@master ~]# tar -zxvf rubygems-1.3.5.tgz
- [root@master rubygems-1.3.5]# ls
- bin ChangeLog cruise_config.rb GPL.txt History.txt lib LICENSE.txt Manifest.txt pkgs Rakefile README setup.rb test util
- [root@master rubygems-1.3.5]# ruby setup.rb
安装rake
- [root@master rubygems-1.3.5]# gem install rake
- Successfully installed rake-0.9.2.2
- 1 gem installed
- Installing ri documentation for rake-0.9.2.2...
- Installing RDoc documentation for rake-0.9.2.2...
Gem安装mysql
- [root@master puppet-dashboard]# gem install mysql -- --with-mysql-config=/usr/bin/mysql_config
- Building native extensions. This could take a while...
- Successfully installed mysql-2.8.1
- 1 gem installed
- Installing ri documentation for mysql-2.8.1...
下载dashboard
- [root@master ~]# wget http://downloads.puppetlabs.com/dashboard/puppet-dashboard-1.2.6.tar.gz
- [root@master ~]# tar -zxvf puppet-dashboard-1.2.6.tar.gz
- [root@master ~]# mv puppet-dashboard-1.2.6 /usr/local/puppet-dashboard
增加dashboard的用户和组
- [root@master puppet-dashboard]# groupadd puppet-dashboard
- [root@master puppet-dashboard]# useradd -g puppet-dashboard puppet-dashboard
- [root@master puppet-dashboard]# chown -R puppet-dashboard:puppet-dashboard /usr/local/puppet-dashboard/
复制配置文件
- [root@master ~]# cd /usr/local/puppet-dashboard/
- [root@master puppet-dashboard]# cp config/database.yml.example config/database.yml
- [root@master puppet-dashboard]# cp config/settings.yml.example config/settings.yml
创建dashboard数据库和用户
- [[email protected]]# mysql -uroot -p'密码'
- mysql> create database dashboard default charset utf8;
- Query OK, 1 row affected (0.00 sec)
- mysql> use dashboard
- Database changed
- mysql> grant all on dashboard.* to dashboard@localhost identified by "password";
- Query OK, 0 rows affected (0.00 sec)
- mysql> flush privileges;
- Query OK, 0 rows affected (0.00 sec)
编辑database.yml文件,输入数据库的名称,用户和密码
- [root@master puppet-dashboard]# vim config/database.yml
- production:
- database: dashboard
- username: dashboard
- password: Password
- encoding: utf8
- adapter: mysql
创建数据库表,注意当前目录仍然是/opt/puppet-dashboard/config
- [root@master config]# rake RAILS_ENV=production db:migrate
- == BasicSchema: migrating ====================================================
- -- create_table(:assignments, {:force=>true})
- -> 0.0135s
- -- create_table(:nodes, {:force=>true})
- -> 0.0121s
- -- create_table(:services, {:force=>true})
- -> 0.0125s
- == BasicSchema: migrated (0.0385s) ===========================================
- == CreateNodeGroupMemberships: migrating =====================================
- -- create_table(:node_group_memberships)
- -> 0.0194s
- == CreateNodeGroupMemberships: migrated (0.0195s) ============================
- == CreateNodeClasses: migrating ==============================================
- -- create_table(:node_classes)
- -> 0.0121s
- == CreateNodeClasses: migrated (0.0122s) =====================================
- == CreateNodeClassMemberships: migrating =====================================
- -- create_table(:node_class_memberships)
- -> 0.0123s
- == CreateNodeClassMemberships: migrated (0.0124s) ============================
- == CreateNodeGroups: migrating ===============================================
- -- create_table(:node_groups)
- -> 0.0119s
- == CreateNodeGroups: migrated (0.0120s) ======================================
- == CreateNodeGroupClassMemberships: migrating ================================
- -- create_table(:node_group_class_memberships)
- -> 0.0127s
- == CreateNodeGroupClassMemberships: migrated (0.0128s) =======================
服务器端配置
- [master]
- reports=store,http
- reporturl=http://192.168.2.98:3000/reports
- reportdir=/var/lib/puppet/reports
- node_terminus=exec
- external_nodes=/usr/bin/env PUPPET_DASHBOARD_URL=http://localhost:3000 /usr/local/puppet-dashboard/bin/external_node
重启Puppetmaster服务
- [root@master puppet-dashboard]# service puppetmaster restart
- 停止 puppetmaster: [确定]
- 启动 puppetmaster: [确定]
客户端配置
- [agent]
- server=master.puppet
- report=true
- runinterval=3600
重启puppet服务
- [root@client1 ~]# service puppet restart
启动测试,这样启动造成找不到数据库
- [root@gh puppet-dashboard]# script/server -p 3100
- => Booting WEBrick
- => Rails 2.3.5 application starting on http://0.0.0.0:3100
- Database isn't the current migration version: expected 20110130010154, got 0
- You must either run 'rake db:migrate' or set environmental variable NO_MIGRATION_CHECK
正确启动方式
- [root@master puppet-dashboard]# ./script/server -e production –d
- => Booting WEBrick
- => Rails 2.3.12 application starting on http://0.0.0.0:3000
- => Call with -d to detach
- => Ctrl-C to shutdown server
- [2012-02-28 11:55:44] INFO WEBrick 1.3.1
- [2012-02-28 11:55:44] INFO ruby 1.8.7 (2011-06-30) [x86_64-linux]
- [2012-02-28 11:55:44] INFO WEBrick::HTTPServer#start: pid=29333 port=3000
访问网址,截图如下
刷新一下浏览器,可以在puppet dashboard上看到:
Backgroud Tasks
1 pending tasks
监控
env RAILS_ENV=production script/delayed_job -p dashboard -n 1 -m start
运行任务
rake RAILS_ENV=production jobs:work
重新查看浏览器,发现有一个report了