这实验至少用了我4天,全是坑

Puppet Dasshboard是由支持Puppet开发的公司Puppetlabs创建的,是Ruby on Rails程序。可以作为一个ENC(外部节点分类器)以及一个报告工具,并且正在逐渐成为一个包含许多Puppet新功能的集成界面,例如审计和资源管 理功能。 Puppet Dashboard是一个Ruby on Rails程序,用于显示Puppet master和agent的相关信息。它允许你查看从一个或多个Puppet master汇总的图形和报告数据。它同时从一个或者多个Puppet master上收集来自于Puppet agent的资产数据(主机的Fact和其他信息)。最后,它能作为一个ENC来配置Puppet节点,并指定这些节点上的类和参数。

参考

http://docs.puppetlabs.com/guides/installing_dashboard.html

https://github.com/sodabrew/puppet-dashboard

https://forge.puppet.com/puppetlabs/dashboard

puppet module install puppetlabs-dashboard --version 0.0.4

Puppet 实验十 centos 安装 puppet-dashboard 仪表盘_系统/运维

看下怎么用

Puppet 实验十 centos 安装 puppet-dashboard 仪表盘_系统/运维_02

更新下节点 site。pp配置

vi /etc/puppet/manifests/site.pp

node default {

class {'dashboard':

dashboard_ensure => 'present',

dashboard_user => 'puppet-dbuser',

dashboard_group => 'puppet-dbgroup',

dashboard_password => 'changeme',

dashboard_db => 'dashboard_prod',

dashboard_charset => 'utf8',

dashboard_site => $fqdn,

dashboard_port => '8080',

mysql_root_pw => 'changemetoo',

passenger => true,

}

}

验证下site。pp配置

Puppet 实验十 centos 安装 puppet-dashboard 仪表盘_Linux_03

模块没有自带mysql ?

看一下模板帮助

puppet help dashboard

Puppet 实验十 centos 安装 puppet-dashboard 仪表盘_系统/运维_04

好吧,没有帮助

看一下readme

* Ensure that you have Puppet 2.7.6 or greater installed. This face MAY work on version 2.7.2 or later, but it's not been tested.

不用总行了把,容我卸载下,我靠,还不能批量卸载

Puppet 实验十 centos 安装 puppet-dashboard 仪表盘_Linux_05

还好我有快照,一切恢复出厂

Puppet 实验十 centos 安装 puppet-dashboard 仪表盘_Linux_06

手动安装

yum install -y git libmysqlclient-dev libpq-dev libsqlite3-dev ruby-dev libxml2-dev libxslt-dev nodejs

Puppet 实验十 centos 安装 puppet-dashboard 仪表盘_系统/运维_07

找到一个ruby开发环境包

yum install -y ruby-devel.x86_64

边下载仪表盘,边查为毛没有这些软件包

cd /usr/share && \

git clone https://github.com/sodabrew/puppet-dashboard.git && \

cd puppet-dashboard

Puppet 实验十 centos 安装 puppet-dashboard 仪表盘_系统/运维_08

centos没有mysql了,都是mariadb了,为了兼容性,先安装mysql

cd /usr/local/src/

wget http://repo.mysql.com/mysql57-community-release-el7-8.noarch.rpm

rpm -ivh mysql57-community-release-el7-8.noarch.rpm

Puppet 实验十 centos 安装 puppet-dashboard 仪表盘_系统/运维_09

yum install -y mysql-community-server.x86_64 mysql-community-client.x86_64

查了一下mariadb 库还在,用mysql 替换了,

Puppet 实验十 centos 安装 puppet-dashboard 仪表盘_Linux_10

Puppet 实验十 centos 安装 puppet-dashboard 仪表盘_Linux_11

systemctl restart mysqld

grep 'temporary password' /var/log/mysqld.log

mysql -u root -p

alter user 'root'@'localhost' identified by '12345.coM';

flush privileges;

或者直接不要密码

vim /etc/my.cnf

skip-grant-tables

Puppet 实验十 centos 安装 puppet-dashboard 仪表盘_Linux_12

创建表和用户

mysql -p -e"CREATE DATABASE dashboard_production CHARACTER SET utf8;" && \

mysql -p -e"CREATE USER 'dashboard'@'localhost' IDENTIFIED BY '12345.coM';" && \

mysql -p -e"GRANT ALL PRIVILEGES ON dashboard_production.* TO 'dashboard'@'localhost';"

mysql 更新下配置

vi /etc/mysql.my.cnf

max_allowed_packet = 32M

仪表盘库

gem install bundler && \

bundle install --deployment

出错鸟,不能以root安装

su pactera

Puppet 实验十 centos 安装 puppet-dashboard 仪表盘_系统/运维_13

配置数据库连接

cd /usr/share/puppet-dashboard/config

sudo cp database.yml.example database.yml

vi /usr/share/puppet-dashboard/config/database.ymlproduction:

database: dashboard_production

username: dashboard

password: 12345.coM

encoding: utf8

adapter: mysql2

出错了

rake RAILS_ENV=production db:migrate

rake RAILS_ENV=production db:migrate --trace

Puppet 实验十 centos 安装 puppet-dashboard 仪表盘_Linux_14

rake 是ruby写的,ruby我已经安装了啊

Puppet 实验十 centos 安装 puppet-dashboard 仪表盘_Linux_15

gem install -v=0.8.7 rake

Puppet 实验十 centos 安装 puppet-dashboard 仪表盘_Linux_16

难道是ruby要升级么

yum install -y centos-release-scl-rh

yum install -y rh-ruby23

scl enable rh-ruby23 bash

ruby -v 

Puppet 实验十 centos 安装 puppet-dashboard 仪表盘_Linux_17

gem install rdoc

Puppet 实验十 centos 安装 puppet-dashboard 仪表盘_Linux_18

cd /usr/share/puppet-dashboard/

rake RAILS_ENV=production db:migrate

仍然出错

Puppet 实验十 centos 安装 puppet-dashboard 仪表盘_Linux_19

gem list下,rake没有安装好么

Puppet 实验十 centos 安装 puppet-dashboard 仪表盘_系统/运维_20

再次安装下rake

gem install -v=0.8.7 rake

Puppet 实验十 centos 安装 puppet-dashboard 仪表盘_Linux_21

Puppet 实验十 centos 安装 puppet-dashboard 仪表盘_系统/运维_22

还是有错误

Could not load rdoc/task. Some rake tasks may not be available without rdoc/task.

Puppet 实验十 centos 安装 puppet-dashboard 仪表盘_Linux_23

仪表盘组件先安装下

gem install bundler && \

bundle install --deployment

Puppet 实验十 centos 安装 puppet-dashboard 仪表盘_系统/运维_24

gem source-a https://ruby.taobao.org

居然404,后来想起来taobao源不再维护ruby了

依赖库还有依赖库的问题


gem install -v=0.8.7 rake

先睡觉了