** Creating cookbook nginx
** Creating README for cookbook: nginx
** Creating CHANGELOG for cookbook: nginx
** Creating metadata for cookbook: nginx
root@knife2:/home/young/chef-repo#
#Instead of FQDN, I used hosts file.
#Here chef-server's IP is 192.168.56.3. To prevent route error(http.rb)
"ERROR: Errno::EHOSTUNREACH: No route to host - connect(2)"
edit like bellows. 192.168.56.3 is chef-server and then modify the knife.rb's chef-server url
127.0.0.1 localhost
127.0.1.1 ubuntu1204-3
127.0.1.1 apache2-1
192.168.56.105 knife2
192.168.56.3 chef-server
#knife.rb's server_url
root@knife2:/home/young/chef-repo/cookbooks# cat ../.chef/knife.rb
log_level :debug
log_location STDOUT
node_name 'young'
client_key '/home/young/chef-repo/.chef/young.pem'
validation_client_name 'chef-validator'
validation_key '/etc/chef-server/chef-validator.pem'
chef_server_url 'https://chef-server:443'
syntax_check_cache_path '/home/young/chef-repo/.chef/syntax_check_cache'
cookbook_path ["./cookbooks"]
#uploading recipes
root@knife2:/home/young/chef-repo# knife cookbook upload nginx
Uploading nginx [0.1.0]
Uploaded 1 cookbook.
root@knife2:/home/young/chef-repo#
#Bootstrapping Process
root@knife2:/home/young/chef-repo# knife bootstrap chef-client1 --sudo -x young -P mypassword
Bootstrapping Chef on chef-client1
ERROR: Errno::ENOENT: No such file or directory - /etc/chef-server/chef-validator.pem
root@knife2:/home/young/chef-repo# ls /etc/chef/
root@knife2:/home/young/chef-repo# mkdir /etc/chef-server
root@knife2:/home/young/chef-repo# cp .chef/chef-validator.pem /etc/chef-server/
root@knife2:/home/young/chef-repo# knife bootstrap 192.168.56.104 --sudo -x young -P password
Bootstrapping Chef on 192.168.56.104
192.168.56.104 --2014-01-26 14:39:52-- https://www.opscode.com/chef/install.sh
192.168.56.104 Resolving www.opscode.com (www.opscode.com)... 184.106.28.90
192.168.56.104 Connecting to www.opscode.com (www.opscode.com)|184.106.28.90|:443... connected.
192.168.56.104 HTTP request sent, awaiting response... 200 OK
192.168.56.104 Length: 14101 (14K) [application/x-sh]
192.168.56.104 Saving to: `STDOUT'
192.168.56.104
192.168.56.104 Chef Client finished, 0 resources updated
root@chef-client1:~# which chef-client
/usr/bin/chef-client
root@chef-client1:~# stat /usr/bin/chef-client
File: `/usr/bin/chef-client' -> `/opt/chef/bin/chef-client'
Size: 25 Blocks: 0 IO Block: 4096 symbolic link
Device: fc00h/64512d Inode: 262550 Links: 1
Access: (0777/lrwxrwxrwx) Uid: ( 0/ root) Gid: ( 0/ root)
Access: 2014-01-26 14:40:39.510961635 +0900
Modify: 2014-01-26 14:40:39.426961639 +0900
Change: 2014-01-26 14:40:39.426961639 +0900
Birth: -
root@chef-client1:~# chef-client -o nginx
Starting Chef Client, version 11.8.2
[2014-01-26T14:49:27+09:00] WARN: Run List override has been provided.
[2014-01-26T14:49:27+09:00] WARN: Original Run List: [recipe[nginx]]
[2014-01-26T14:49:27+09:00] WARN: Overridden Run List: [recipe[nginx]]
resolving cookbooks for run list: ["nginx"]
Synchronizing Cookbooks:
- nginx
Compiling Cookbooks...
Converging 1 resources
Recipe: nginx::default
* bash[install_nginx] action run
- execute "bash" "/tmp/chef-script20140126-4475-tsf31c"
Chef Client finished, 1 resources updated
root@chef-client1:~# ps -ef | grep nginx
root 4657 1 0 14:49 ? 00:00:00 nginx: master process /usr/sbin/nginx
www-data 4658 4657 0 14:49 ? 00:00:00 nginx: worker process
www-data 4659 4657 0 14:49 ? 00:00:00 nginx: worker process
www-data 4660 4657 0 14:49 ? 00:00:00 nginx: worker process
www-data 4661 4657 0 14:49 ? 00:00:00 nginx: worker process
root 4663 2039 0 14:49 pts/0 00:00:00 grep --color=auto nginx
root@chef-client1:~#
No comments:
Post a Comment