Skip to content

Instantly share code, notes, and snippets.

@tikitikipoo
Last active December 20, 2015 02:59
Show Gist options
  • Save tikitikipoo/6060384 to your computer and use it in GitHub Desktop.
Save tikitikipoo/6060384 to your computer and use it in GitHub Desktop.
knife (solo) チートシート
vagrantでのテストをする場合
cd /some/where
vagrant init
vagrant ssh-config --host <some-hostname> >> ~/.ssh/config
vagrant up
Chefリポジトリを作成
knife solo init <chef-repo-name>
環境を整える(remoteにchef-soloを入れる)
knife solo prepare <some-hostname>
knife solo prepare [email protected] -p 12345
クックブック作成 & レシピ編集
knife cookbook create <cookbook-name> -o site-cookbooks
OpsCode CommunityのCookbookを利用
knife cookbook site vendor <cookbook-name>
knife cookbook site vendor hostname
git submodule addで利用
git submodule add -f https://github.com/opscode-cookbooks/<cookbook-name> cookbooks/<cookbook-name>
git submodule add -f https://github.com/opscode-cookbooks/apt cookbooks/apt
レシピをノードに適用
knife solo cook <node-name>
knife solo cook vagrant-ubuntu12.0.4-sakura
knife solo cook [email protected] -p 12345
@tikitikipoo
Copy link
Author

参考になる資料

初めてのChefの教室 (v1.2 Chef11対応版) by Yusuke Ando
https://speakerdeck.com/yandod/chu-metefalsecheffalsejiao-shi-v1-dot-2-chef11dui-ying-ban

@tikitikipoo
Copy link
Author

出所:http://blog.mizoshiri.com/archives/1387

Vagrantfileの再読み込み(一度落ちるから気をつけて)

$ vagrant reload

VMの状況の確認

$ vagrant status

まだつかったことないけど、一時的な停止

$ vagrant suspend

suspendからの復帰

vagrant resume

シャットダウン

$ vagrant halt

立ち上げ

$ vagrant up

自分のBoxを作れます。これでデザイナーさんなりにboxをあげて共有してあげてください。便利!!

$ vagrant package

We can then restore it with the same command we used to set up our virtual machine in the first place.

$ vagrant box add

delete our virtual machine

$ vagrant destroy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment