Category: Chef


knife bootstrap json-attributes example

By polfilm,

This is how you properly pass Json string in knife bootstrap

$ knife bootstrap --run-list "role[myiisapp]" --json-attributes "{\"remote_mysql\": {\"ip\": \"10.10.10.100\"}}" --ssh-user root --ssh-password password hostname

berks upload – Encoding::InvalidByteSequenceError: “\xE2” on US-ASCII

By polfilm,

This happens during cookbook upload to chef server and is due to unicode characters in README.md (at least in my case)

Ridley::CookbookResource crashed!
Encoding::InvalidByteSequenceError: "\xE2" on US-ASCII

I’ve used the following command to list offending characters in README.md. Then removed with gedit, resaved and…. upload success!

grep --color='auto' -P -n "[\x80-\xFF]" README.md

Full stack here: http://fpaste.org/51397/

Reported, here: https://github.com/RiotGames/berkshelf/issues/708

Chef Server Name Not Resolved During Cookbook Upload [fix]

By polfilm,

Occurs when FQDN of the server is not resolvable on local network.
On chef server, create file called /etc/chef-server/chef-server.rb, and added below lines…

server_name = "192.168.56.11"
api_fqdn server_name
nginx['url'] = "https://#{server_name}"
nginx['server_name'] = server_name
lb['fqdn'] = server_name
bookshelf['vip'] = server_name

Then, run chef-server-ctl reconfigure.

Chef Solo Pattern with Berkshelf

By polfilm,

http://spin.atomicobject.com/2013/01/03/berks-simplifying-chef-solo-cookbook-management-with-berkshelf/
https://github.com/englishm/chef-solo-pattern
Chef – berkshelf lesson for dummies like me Ermahgerd!
http://leonard.io/blog/2012/05/installing-ruby-1-9-3-on-ubuntu-12-04-precise-pengolin/
https://github.com/opscode/nagios-quick-start
http://stackoverflow.com/questions/14173701/chef-upload-and-re-apply-a-cookbook-to-a-node

Knife EC2 [official]

By polfilm,

This is the official Opscode Knife plugin for EC2. This plugin gives knife the ability to create, bootstrap, and manage EC2 instances.

https://github.com/opscode/knife-ec2

knife ec2 server create -r "role[ubuntu]" -I ami-399ca94d -f m1.small -S knife -i ~/.ssh/knife.pem --ssh-user ubuntu --region eu-west-1 -Z eu-west-1a

knife ec2 server list --region eu-west-1