Contenu connexe
Similaire à Chef study (20)
Chef study
- 3. Chef Server
% wget https://opscode-omnibus-packages.s3.amazonaws.com/ubuntu/12.04/
x86_64/chef-server_11.0.8-1.ubuntu.12.04_amd64.deb
% sudo dpkg -i chef-server_11.0.8-1.ubuntu.12.04_amd64.deb
Chef-Server
WorkStation Node
13年10月2日水曜日
- 4. WorkStation
server% knife configure -i
の生成
client% mkdir .chef
client% scp <server>:~/thirai.pem .chef/
client% scp <server>:~/chef-validator.pem .chef/
client% vim .chef/knife.rb
log_level :info
log_location STDOUT
node_name 'thirai'
client_key '/Users/thirai/chef-repo/.chef/thirai.pem'
validation_client_name 'chef-validator'
validation_key '/Users/thirai/chef-repo/.chef/chef-validator.pem'
chef_server_url 'https://10.200.10.96'
syntax_check_cache_path '/Users/thirai/chef-repo/.chef/syntax_check_cache'
client% knife node list # knife コマンドが利用可能に。
foo01
foo02
...
Chef-Server
WorkStation Node
13年10月2日水曜日
- 5. Chef-Repo
chef-repo
!"" cookbooks
# %"" nginx
# !"" attributes
# !"" definitions
# !"" files
# # %"" default
# # %"" tests
# # %"" minitest
# # %"" support
# !"" recipes
# %"" templates
# !"" debian
# !"" default
# # !"" modules
# # %"" plugins
# !"" gentoo
# %"" ubuntu
!"" data_bags
!"" environments
%"" roles
Chef-Server
WorkStation Node
13年10月2日水曜日
- 7. Cookbooks
* Attributes
* Templates
* Recipe
default['apache']['package'] = "httpd"
default['apache']['pid_file'] = "/var/run/httpd.pid"
default['apache']['timeout'] = 300
default['apache']['keepalive'] = "On"
13年10月2日水曜日
- 8. Cookbooks
* Attributes
* Templates
* Recipe
PidFile <%= node['apache']['pid_file'] %>
Timeout <%= node['apache']['timeout'] %>
KeepAlive <%= node['apache']['keepalive'] %>
13年10月2日水曜日
- 11. Roles
name "webservers"
description "role of web servers"
run_list "recipe[apache2]", "recipe[apache2::mod_fastcgi]"
override_attributes "apache2" => { "max_children" => "50" }
recipe/default.rb recipe/mod_fastcgi.rb
13年10月2日水曜日
- 13. Data Bags
% ${EDITOR} bofh.json
{
"id": "bofh",
"ssh_keys": "ssh-rsa AAAAB3Nz...yhCw== bofh",
"groups": [ "sysadmin", "dba", "devops" ],
"uid": 2001,
"shell": "/bin/bash",
"comment": "BOFH",
"nagios": {
"pager": "8005551212@txt.att.net",
"email": "bofh@example.com"
},
"openid": "bofh.myopenid.com"
}
% knife data bag create users
% knife data bag from file users ./bofh.json
13年10月2日水曜日