knife-solo って何?

ssh の設定

[~/chef-test]$ vagrant ssh-config --host melody
Host melody
  HostName 192.168.38.129
  User vagrant
  Port 22
  UserKnownHostsFile /dev/null
  StrictHostKeyChecking no
  PasswordAuthentication no
  IdentityFile /Users/atsushi/.vagrant.d/insecure_private_key
  IdentitiesOnly yes
  LogLevel FATAL
[~/chef-test]$ vagrant ssh-config --host melody >> ~/.ssh/config

これは、vagrant が使う ethernet0 の IP アドレス。
ethernet1 に割り振った固定 IP アドレスに変更する必要がある
cf. Chef Vagrant + VMWare Fusion で 固定 IP

[~/chef-test]$ cat ~/.ssh/config
Host melody
  HostName 192.168.38.100
  User vagrant
  Port 22
  UserKnownHostsFile /dev/null
  StrictHostKeyChecking no
  PasswordAuthentication no
  IdentityFile /Users/atsushi/.vagrant.d/insecure_private_key
  IdentitiesOnly yes
  LogLevel FATAL

[~/chef-test]$ ssh melody
Last login: Sun Feb  2 14:37:45 2014 from 192.168.38.1
[vagrant@vagrant-centos-6 ~]$ uname -r
2.6.32-358.2.1.el6.x86_64
[vagrant@vagrant-centos-6 ~]$ exit
logout
Connection to 192.168.38.100 closed.

ホスト (Mac) に knife-solo のインストール

[~/chef-test]$ gem search knife-solo

*** REMOTE GEMS ***

knife-solo (0.4.1)
knife-solo_data_bag (0.4.0)

[~/chef-test]$ sudo gem install knife-solo
...
29 gems installed

kitchen (repository) と cookbook を作成する

ゲスト (CentOS6.4) に chef-solo をリモートでインストール

[~/chef-test/chef-repo]$ knife solo prepare melody
WARNING: No knife configuration file found
Bootstrapping Chef...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 13347  100 13347    0     0   1932      0  0:00:06  0:00:06 --:--:-- 39961
Downloading Chef 11.8.2 for el...
downloading https://www.opscode.com/chef/metadata?v=11.8.2&prerelease=false&p=el&pv=6&m=x86_64
  to file /tmp/install.sh.2777/metadata.txt
trying curl...
url	https://opscode-omnibus-packages.s3.amazonaws.com/el/6/x86_64/chef-11.8.2-1.el6.x86_64.rpm
md5	10f3d0da82efa973fe91cc24a6a74549
sha256	044558f38d25bbf75dbd5790ccce892a38e5e9f2a091ed55367ab914fbd1cfed
downloaded metadata file looks valid...
downloading https://opscode-omnibus-packages.s3.amazonaws.com/el/6/x86_64/chef-11.8.2-1.el6.x86_64.rpm
  to file /tmp/install.sh.2777/chef-11.8.2-1.el6.x86_64.rpm
trying curl...
Checksum compare with sha256sum succeeded.
Installing Chef 11.8.2
installing with rpm...
警告: /tmp/install.sh.2777/chef-11.8.2-1.el6.x86_64.rpm: ヘッダ V4 DSA/SHA1 Signature, key ID 83ef826a: NOKEY
準備中...                ########################################### [100%]
   1:chef                   ########################################### [100%]
Thank you for installing Chef!
Generating node config 'nodes/melody.json'...
[~/chef-test/chef-repo]$

リモートで実行される localhost.json と solo.rb

[~/chef-test]$ tree
.
├── Vagrantfile
└── chef-repo
    ├── cookbooks
    ├── data_bags
    ├── environments
    ├── nodes
    │   └── melody.json
    ├── roles
    └── site-cookbooks
        └── hello
            ├── CHANGELOG.md
            ├── README.md
            ├── attributes
            ├── definitions
            ├── files
            │   └── default
            ├── libraries
            ├── metadata.rb
            ├── providers
            ├── recipes
            │   └── default.rb
            ├── resources
            └── templates
                └── default

18 directories, 6 files

Hello knife-solo

knife-solo コマンド

コマンド動作
$ knife solo init chef-repoリモート実行用の kitchen (repository) を作る
$ knife solo prepare <host><host> に chef-solo をインストール
$ knife solo cook <host><host> で recipe を実行する
$ knife solo clean <host><host> から recipe を削除する

Chef


トップ   編集 凍結 差分 バックアップ 添付 複製 名前変更 リロード   新規 一覧 単語検索 最終更新   ヘルプ   最終更新のRSS   sitemap
Last-modified: 2014-02-17 (月) 00:22:12 (3948d)
Short-URL:
ISBN10
ISBN13
9784061426061