Ubuntu下配置威力强大的Foreman

      之前听说过Foreman的存在,但是一直没有去试过,直到今天下午,打算把Puppet所有相关的组件都尝试搭建一次,看看具体功能有多强大。

网上搜,你能搜到一大堆关于如何在CentOS下安装配置Foreman的文章,不少都是ctrl+c,ctrl+v的,格式乱的不堪入目。

官方的文档很简洁,简洁到你都无从配置出正确的foreman出来。OK,本文的目的就是让你在Ubuntu上配置出威力强大的Foreman出来。

 

系统信息:Ubuntu 12.04

 

 1.添加源

   新建/etc/apt/sources.list.d/foreman.list:

# Stable packages
deb http://deb.theforeman.org/ stable main

# Testing packages
deb http://deb.theforeman.org/ testing main

# Nightly builds. Beware: HERE BE DRAGONS
deb http://deb.theforeman.org/ nightly main

   下载并添加key:

wget -q http://deb.theforeman.org/foreman.asc -O- | apt-key add -

 亲,别忘了更新哦

apt-get update

 

2.安装和配置文件

先装一些基本包,这里我用的是sqlite,需要什么sql就下相应的包

apt-get install foreman foreman-sqlite3 foreman-libvirt

 

修改配置

数据库配置可以默认 database.yml:

roduction:
  adapter: sqlite3
  database: db/production.sqlite3
  pool: 5
  timeout: 5000

development:
  adapter: sqlite3
  database: db/development.sqlite3
  pool: 5
  timeout: 5000

# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
  adapter: sqlite3
  database: db/test.sqlite3
  pool: 5
  timeout: 5000

设置setting.yaml

#your default puppet server - can be overridden in the host level
#if none specified, plain "puppet" will be used.
:puppet_server: puppet.master.com
:unattended: true
:puppetconfdir: /etc/puppet/puppet.conf
:login: false
:require_ssl: false

 

复制https://raw.github.com/theforeman/puppet-foreman/master/templates/foreman-report.rb.erb 到 /usr/lib/ruby/1.8/puppet/reports/foreman.rb 

root@sws-master:/etc/foreman# wget https://raw.github.com/theforeman/puppet-foreman/master/templates/foreman-report.rb.erb
--2012-09-07 20:19:39--  https://raw.github.com/theforeman/puppet-foreman/master/templates/foreman-report.rb.erb
Resolving raw.github.com (raw.github.com)... 207.97.227.243
Connecting to raw.github.com (raw.github.com)|207.97.227.243|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1059 (1.0K) [text/plain]
Saving to: `foreman-report.rb.erb'

100%[============================================================================>] 1,059       --.-K/s   in 0s      

2012-09-07 20:19:40 (420 MB/s) - `foreman-report.rb.erb' saved [1059/1059]

 

修改以下值,IP值为你服务器的IP,这里是本机:

$foreman_url='http://127.0.0.1:3000/'

 

修改puppetmaster配置

reports = log,foreman

 

修改puppet配置

report = true

 

 

初始化数据库

cd <foreman installation path> && RAILS_ENV=production rake db:migrate

 

如果需要从puppet导入数据(without storeconfig):

rake puppet:import:hosts_and_facts RAILS_ENV=production

如果使用了storeconfigs

rake puppet:migrate:populate_hosts RAILS_ENV=production

 

OK,启动foreman。

 

打开你的web输入:127.0.0.1:3000

 参考资料:

http://theforeman.org/projects/foreman/wiki/Puppet_Reports

 

posted @ 2012-09-07 11:30  牛皮糖NewPtone  阅读(1649)  评论(0编辑  收藏  举报