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\": \"\"}}" --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 (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 Then removed with gedit, resaved and…. upload success!

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

Full stack here:

Reported, here:

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 = ""
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,
Chef – berkshelf lesson for dummies like me Ermahgerd!

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.

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