Chef CentOS

Материал из noname.com.ua
Перейти к навигацииПерейти к поиску

Chef on CentOS 6.3

Тут коротко об установке chef на CentOS 6.3

Похоже что эта статья полностью устарела
Новая версия тут: http://wiki.sirmax.noname.com.ua/index.php?title=Chef_CentOS_v11

rps

Подключить epel

wget http://ftp.tlk-l.net/pub/mirrors/fedora-epel/6/i386/epel-release-6-8.noarch.rpm
rpm -ivh epel-release-6-8.noarch.rpm 
yum list | grep rubygem   | awk '{ print $1 }' | xargs  -I {}  yum -y install {} 
yum -y install openssl-devel ruby-ri  ruby-libs ruby-irb  gcc ruby-devel  make autoconf automake 

У меня вылезло много косяков которые в один ход лечатся вот так: (судя по всему гемы из рпм старые или слегка кривые)

sudo gem install rubygems-update 
sudo update_rubygems    

Ставим chef через gem

sudo gem install chef --no-ri --no-rdoc

На этой стадии у меня заработал chef-solo Далее небольшая копипаста из документации

Установка сервера

Solo Configuration File: solo.rb

We're going to use Chef Solo to run the bootstrap recipes, so it needs to be configured to point the right locations.

First, create a chef directory in /etc

sudo mkdir /etc/chef/

/etc/chef/solo.rb

Now create a chef-solo configuration file. Save it as /etc/chef/solo.rb. /etc/chef/solo.rb

file_cache_path "/tmp/chef-solo"
cookbook_path "/tmp/chef-solo/cookbooks"

Chef Solo Attributes Configuration: chef.json

Chef can use JSON data passed to Solo or the Client to specify a certain list of recipes to run and specific Attributes to configure on the system. We're going to configure the node with a JSON file particular to whether it will be a Chef Server or a Chef Client. Create the file ~/chef.json with the applicable contents below.

Chef Server with no webui: Server Attributes (API Only)

{
  "chef_server": {
    "server_url": "http://localhost:4000"
  },
  "run_list": [ "recipe[chef-server::rubygems-install]" ]
}
Chef Server with the webui installed and enabled:
Server Attributes (API and WebUI)
{
  "chef_server": {
    "server_url": "http://localhost:4000",
    "webui_enabled": true
  },
  "run_list": [ "recipe[chef-server::rubygems-install]" ]
}

Важно!


~/chef.json

{
  "chef_server": {
    "server_url": "http://localhost:4000",
    "webui_enabled": true
  }, 
  "build-essential": {
    "compiletime": true
  }, 
  "run_list": [ "recipe[build-essential]","recipe[chef-server::rubygems-install]" ]
}

Засускаем chef-solo

sudo chef-solo -c /etc/chef/solo.rb -j ~/chef.json -r http://s3.amazonaws.com/chef-solo/bootstrap-latest.tar.gz

На данной стадии сервер вроде-бы работает