Getting started with InSpec
InSpec is an open-source testing framework to verify your infrastructure satisfies the design requirements. In this article, we will learn to install and use InSpec with Chef. Install InSpec Navigate to https://downloads.chef.io/inspec, and download the…
Undefined method or attribute error in a Chef recipe
There are multiple reasons Chef can display the following error message NoMethodError ------------- Undefined method or attribute `...' on `node' There are many ways to reference an attribute in a Chef recipe: node['ATTRIBUTE_NAME'] (the…
Add SSH key to a Jenkins Git step
To access a Git repository Jenkins can use an SSH key. To add the SSH key to the Jenkins server use the following Chef script Store the SSH key in an encrypted data bag called “keys”. { "id": "ci_private_keys", "ci_github_key": "-----BEGIN…
Generate a GUID in Chef with Ruby
When you need a unique string to name a resource in your Chef scrip, generate a GUID with SecureRandom.uuid To make sure the resource always gets a unique name: log "#{SecureRandom.uuid}" do message 'My message' level :info end
Chef custom resource is using the same property name as the called resource
When you create a Chef custom resource, you can call other resources including custom resources you have created. For ease of use it can be convenient to use the same property name as the called resource use. property :delay_mins, Fixnum,…
NoMethodError: undefined method `exists?’ for Chef::Resource::File:Class
When you create a Chef custom resource and use the File class, you need to make slight a change in the syntax you use. In a Chef recipe you can use if File.exists?("#{FileName}") to check for the existence of a file. If we use the same line in a Chef…
Chef file locations
The Chef file and folder locations are different on Linux and Windows machines. This article explains the purpose of each file and the location. Summary Linux Windows Cookbook location /var/chef/cache/cookbooks C:\chef\cache\cookbooks Chef Client run…
Internalize Chocolatey packages
To access Chocolatey packages in your private network you need to download them from the Internet and store them at a location where all servers can access them. You can internalize Chocolatey packages if you have a Chocolatey Business subscription. You…
Launch Windows instances locally with Chef Test Kitchen
Most Linux distributions are free, and do not require product keys to launch them. The steps below are based on the great article at http://kitchen.ci/blog/test-kitchen-windows-test-flight-with-vagrant/ I have summarized the steps below to create a free…
OLD- DevOps Engineering part 1. (Win) – Make your Windows computer easier to use
Set up your computer Display the file extensions On Windows 11 Open the File Explorer Click the arrow next to View and select Show Mark File name extensions and Hidden items On Windows 10 Open File Explorer On the View tab select File name extensions…