Cannot connect to an AWS EC2 Windows instance with WINRM
When we launch an AWS EC2 instance with Windows 2012, Windows 2016, Windows 2019, the “Administrator” local account is automatically created and added to the Administrators group. We can decrypt the Administrator password using the private…
Failed to install cookbooks from lockfile
During Chef cookbook testing with Test Kitchen only one “converge” action can update the Policyfile.lock.json at a time. If you test multiple recipes in the same cookbook, wait for the “Updating policy lock using /usr/local/bin/chef-cli…
Error: Failed to install cookbooks from lockfile
When the CI/CD pipeline loads dependency cookbooks from GitHub and the kitchen converge process throws the error: Error: Failed to install cookbooks from lockfileReason: (CookbookOmnifetch::NotACookbook) The resource at ‘/…’ does not…
chef push always regenerates the revision id and Policyfile.lock.json
If the chef update and chef push commands always regenerate the Policyfile.lock.json file and the revision_id in it, make sure the Chef cookbook contains the chefignore file and it also references all possible Policyfile lock files: If a cookbook file…
Failed to complete #create action: [undefined method `[]’ for nil:NilClass] on …
When we launch a test instance with Chef Test Kitchen, we may get the error message: —–> Starting Test Kitchen (…)—–> Creating …——Exception——->>>>>> Class: Kitchen::ActionFailed>>>>>> Message: 1…
Test Chef cookbooks with Docker containers
Kitchen Dokken is a provisioner to test cookbooks in Docker containers. It is very fast and efficient compared to cloud instances like AWS EC2s, Vagrant boxes, or VMWare virtual machines. Currently, you can only test Linux cookbooks with Kitchen Dokken.…
Is the Chef aws_s3_file resource idempotent?
Yes, it is idempotent. It means, when the target file on the local drive matches the source file in the S3 bucket, Chef Client does not download the file. In the past aws_s3_file was not idempotent, but now behind the scenes it calls remote_file which…
Chef FATAL: IndexError: string not matched
Chef attributes are “Mash” type. From the Ruby Doc: “Mash allows you to create pseudo-objects that have method-like accessors for hash keys.” Mash is inherited from Hash. Attributes can hold any data type, but we need to make sure…
Failed to complete #converge action: [password is a required option]
The Chef Test Kitchen EC2 driver can connect to Windows instances two ways. Using a custom image with known admin account credentials When we use a custom built image which has a local administrator account with known username and password, specify it in…
Search the Chef server
Use the knife search command to list nodes that match the provided criteria Find nodes with a specific cookbook in the run list (runlist) Find nodes with a specific recipe in the run list (runlist) List nodes with a specific OS All Linux nodes All nodes…