`block in filter_instances’: undefined method `empty?’ for nil:NilClass (NoMethodError)
When you try to execute any of the “kitchen” commands in Chef Test Kitchen you may get the following error message. lib/kitchen/config.rb:182:in `block in filter_instances': undefined method `empty?' for nil:NilClass (NoMethodError) This…
Serialize SSH and RSA private keys to store them in a Chef Data Bag
To send RSA private keys to instances, store them in encrypted data bags. The data bag item is a JSON file that contains keys and values inline. Use base64 encoding Base64 encoding converts binary data to ASCII format to represent special characters,…
HTTP Request Returned 409 Conflict: Client already exists
The Chef server maintains the list of registered nodes and clients in its database. When you launch a new instance with Chef you may encounter the following error message: *** Input CHEF_CLIENT_NODE_NAME is undefined, using: IP-0AFE6965 ... *** Starting…
DevOps Engineering part 5. – Create an enterprise cookbook
In this exercise we will create a Chef cookbook for a corporation. It will be robust and include all the necessary elements to be used in a large enterprise. If your company already has established standards, as you progress with this tutorial, copy the…
DevOps Engineering part 4. – Connect to the Chef server
Find a Chef Server To work in a corporate environment, your organization needs access to a Chef server. To learn Chef and test your cookbooks for free, you can create an account on the “hosted” Chef server, maintained by the Chef company. The…
Last characters of a string in Ruby
To get the last characters of a string in Ruby, use the following instructions. If the string is shorter than the selected number of characters, the entire string is returned. a = '12345' b = a[-3..-1] || a puts b Returns 345
DevOps Engineering part 3. – Working with AWS
Personalize your workstation Set up your account in the AWS console If you are not an AWS account administrator, ask your AWS account administrator to do the following for you Create an account in AWS Add the account to the appropriate user group…
Remove Policyfile.rb from your Chef cookbook
When you test your cookbook in Chef Test Kitchen and get the following error, delete the “Policyfile.rb” from your Chef cookbook directory. $$$$$$ You must set your run_list in your policyfile instead of kitchen config. The run_list your…
Chef Data Bags
Create an encrypted Chef data bag There are secrets in most of the Chef cookbooks that we want to protect. We don’t want to give out user names, passwords and AWS keys. In Chef the best place to hide these secrets is the Encrypted Data Bag. A Data…
Unable to satisfy the following requirements error message in Chef Test Kitchen
When Berkshelf in the Chef Test Kitchen cannot resolve the cookbook dependencies, it displays the following error message during converge: Unable to satisfy the following requirements To help Berks to start a fresh calculation, delete the Berksfile.lock…