Generate the Chef cookbook dependency diagram

The Brew viz command reads the Berksfile.lock in the current Chef cookbook directory and saves the cookbook dependency diagram in the graph.png file. The command requires the graphviz utility Install graphviz In the terminal window execute Generate the cookbook dependency diagram and open it in Preview In the Chef cookbook directory execute If you get …

Failed to complete #create action: [You are not authorized to perform this operation

When launching an instance in AWS with Chef Test Kitchen you get the error message >>>>>> Failed to complete #create action: [You are not authorized to perform this operation. Encoded authorization failure message:… Make sure the image does not require the acceptance of the license before you first use it. This applies to Ubuntu, CentOS

RuntimeError: Volume vol-… attached at xvdf but does not conform to this resource’s specifications

When the Chef aws cookbook’s ebs_volume.rb resource tries to bring a volume online, partition, and format it we get the error message: RuntimeError: Volume vol-… attached at xvdf but does not conform to this resource’s specificationsC:/chef/cache/cookbooks/aws/resources/ebs_volume.rb:46:in `block in class_from_file’ Make sure the “size” attribute value in the aws_ebs_volume resource call matches the actual size of …

Migrating from Chef Client version 13 to 15

Syntax changes There are breaking changes between Chef Client version 13 and the newer versions, make sure you update your Chef cookbooks to make them work with the new version of the Chef Client. Resource Since version Old syntax New syntax Notes logger Client 14.0 keyword, cannot use it as a variable or parameter name …

Set the environment name in Chef Test Kitchen

To specify the environment name in the .kitchen.yml file Create a JSON environment file. Chef Zero used by Test Kitchen does not understand YAML or Ruby, we need to use JSON. In your cookbook’s root directory create a directory for environment files Create the myenv.json environment file in the environments directory. Specify the environment name …

Change the AWS account to launch instances with Chef Test Kitchen

The Chef SDK contains Test Kitchen, that can launch server instances to test your Chef cookbooks. Test Kitchen uses the “chef_zero” provisioner to use your workstation as the virtual Chef server. To switch Test Kitchen to launch instances in another AWS account In the .kitchen.yml file update the availability_zone subnet_id aws_ssh_key_id (if different in each account) …

Test Chef cookbooks locally on a virtual workstation

When you use a virtual machine to write your Chef cookbooks you may want to test them locally with Vagrant. This nested virtual machine cannot use a 64 bit operating system, because to run a 64 bit virtual machine, the host computer’s CPU has to provide the CPU Extensions. Currently only physical CPUs can provide …