VagrantとChefをためしてみた 2 -cookbook編-
引き続きcookbookとかしてみる。
VagrantインストールからChefのインストールまでは「VagrantとChefをためしてみた」を参照してください。
今回使用するcookbook https://github.com/opscode-cookbooks/mysql
設定ファイル
- Berkshelf用の設定
Berksfileに以下を定義してMySQLのCookbookを使用することを教えてあげる。
site :opscode cookbook "mysql"
- cookbook用の設定
Vagrantfileに必要なパラメタを定義してあげる。
# chef solo config.vm.provision :chef_solo do |chef| chef.run_list = [ "mysql::client", "mysql::server" ] chef.json = { mysql: { server_root_password: "password", server_repl_password: "password", bind_address: "127.0.0.1" } } end
調理開始
centos65 % vagrant up centos65 % vagrant provision
まつ。まつ。まつ。まつ。
centos65 % vagrant ssh [vagrant@vagrant-centos65 ~]$ mysql --version mysql Ver 14.14 Distrib 5.1.73, for redhat-linux-gnu (x86_64) using readline 5.1 [vagrant@vagrant-centos65 ~]$ mysql -u root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 3 Server version: 5.1.73 Source distribution Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql>
うごいたー ヽ(^。^)ノ