はわわーっ

はわわわわっ

chef-solo使ってみた

メモです。

% knife solo init chef
WARNING: No knife configuration file found
Creating kitchen...
Creating knife.rb in kitchen...
Creating cupboards...
% cd chef
% ls
cookbooks/  data_bags/  environments/  nodes/  roles/  site-cookbooks/
% knife cookbook create hello -o site-cookbooks
** Creating cookbook hello
** Creating README for cookbook: hello
** Creating CHANGELOG for cookbook: hello
** Creating metadata for cookbook: hello
% knife solo prepare 192.168.0.19
Bootstrapping Chef...
Enter the password for yomi@192.168.0.19:
--2014-01-13 20:29:36--  https://www.opscode.com/chef/install.sh
Resolving www.opscode.com (www.opscode.com)... 184.106.28.91
Connecting to www.opscode.com (www.opscode.com)|184.106.28.91|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 14101 (14K) [application/x-sh]
Saving to: `install.sh'

100%[======================================>] 14,101      --.-K/s   in 0s

2014-01-13 20:29:38 (248 MB/s) - `install.sh' saved [14101/14101]


Downloading Chef 11.8.2 for debian...
downloading https://www.opscode.com/chef/metadata?v=11.8.2&prerelease=false&p=debian&pv=6&m=x86_64
  to file /tmp/install.sh.2793/metadata.txt
trying wget...
url     https://opscode-omnibus-packages.s3.amazonaws.com/debian/6/x86_64/chef_11.8.2-1.debian.6.0.5_amd64.deb
md5     d74cb779a02ac3809e6475503f9bb6a2
sha256  74e2c43091e1010f4480530c63d2c4074d8fedc811e77e6fe98951f63753acec
downloaded metadata file looks valid...
downloading https://opscode-omnibus-packages.s3.amazonaws.com/debian/6/x86_64/chef_11.8.2-1.debian.6.0.5_amd64.deb
  to file /tmp/install.sh.2793/chef_11.8.2_amd64.deb
trying wget...
Checksum compare with sha256sum succeeded.
Installing Chef 11.8.2
installing with dpkg...
Selecting previously unselected package chef.
(Reading database ... 24639 files and directories currently installed.)
Unpacking chef (from .../chef_11.8.2_amd64.deb) ...
Setting up chef (11.8.2-1.debian.6.0.5) ...
Thank you for installing Chef!
Generating node config 'nodes/192.168.0.19.json'...
% vim site-cookbooks/hello/recipes/default.rb
% cat site-cookbooks/hello/recipes/default.rb
#
# Cookbook Name:: hello
# Recipe:: default
#
# Copyright 2014, YOUR_COMPANY_NAME
#
# All rights reserved - Do Not Redistribute
#
log "hello"
% vim nodes/192.168.0.19.json
% cat nodes/192.168.0.19.json
{"run_list":[ "hello" ]}
% knife solo cook 192.168.0.19
Running Chef on 192.168.0.19...
Checking Chef version...
Enter the password for yomi@192.168.0.19:
Uploading the kitchen...
Generating solo config...
Running Chef...

Starting Chef Client, version 11.8.2
Compiling Cookbooks...
Converging 1 resources
Recipe: hello::default
  * log[hello] action write

Chef Client finished, 1 resources updated