
As discussed in https://techdirectarchive.com/2018/12/14/get-started-with-opsworks-for-chef-automate/
It is recommended to placed in Git of any of the VCS your cookbooks etc.
A Chef repository contains several directories. Each directory in the StarterKit contains a README file that describes the directory’s purpose, and how to use it for managing your systems with Chef. There are two ways to get cookbooks installed on your Chef server. Either by using the,
– knife commands, or
– Berkshelf commands.
Create a directory on your local PC for storing cookbooks similar to the Chef-repo
- Create a directory on yourlocal computer for storing cookbooks, such as chef-repo. After you addcookbooks, roles, and other files to this repository, we recommend that youupload or store it in a secure, versioned system, such as AWS CodeCommit, Git,or Amazon S3.
- In the chef-repo directory, create the following three directories, as shown in the Starter Kit:
- cookbooks/ – Stores cookbooks that you download or create.
- roles/ – Stores rolesin .rb or .json formats.
- environments/ – Stores environments in .rb or .json formats
Use-Case 1
Use Berkshelf to get Cookbooks from the Chef Supermarket:
Berkshelf is a tool for managing cookbooks and their dependencies. It downloads a specified cookbook into your local storage, which is called the Berkshelf. You can specify which cookbooks and versions to use with your Chef server and upload them.
First: Let’s try this very basic example.
Step 1: Navigate to Chef supermarket https://supermarket.chef.io/ and search for google chrome and Firefox.
Then locate the Berksfile as shown below and add the Firefox and google chrome codebooks as shown below. This ensures the cookbooks are download and stored locally.
Locate the path where you have the starter kit downloaded to, mine is
C:UsersyournameChefAutomatechef-automateserver
Let’s modify the Berksfile and add the cookbooks for Firefox and chrome gotten from the Chef Supermarket.

Step 2: Download and install the cookbooks on your local Computer
– Launch the Chef Dk Client (PowerShell)
Navigate to the Chef local Repository from the Chef Dk terminal otherwise this will not work if you are in a different directory. See image below and run the command. See screenshoot below for the Repo content.
Step 3: Upload this cookbook to Chef Server
This is difference on how it works on Linux than on Windows.
See link: https://docs.aws.amazon.com/opsworks/latest/userguide/opscm-starterkit.html
For Windows: Ensure the Execution Policy in PowerShell is set to RemoteSigned. The execution policy ensures you can load configuration files and determine which script if any must be digitally signed. See the image below on how to set the execution policy to RemoteSigned.
See https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.security/set-executionpolicy?view=powershell-6
This simply restricts us from running unsigned PowerShell scripts downloaded from the Internet.
Run berksinstall
Otherwise, you wouldn’t be able upload your cookbooks. Verify if this is installed, by running the command below in the console
berks –version
Next run the command below to add the SSL Cert file.
$env:SSL_CERT_FILE="ca_certsopsworks-cm-ca-2016-root.pem"
Then run berks upload to upload to the Chef Server
'berks upload'
Finally remove the SSL Cert File
Remove-Item Env:SSL_CERT_FILE
To verify that this worked, simply run the command “knife cookbook list” as shown below
https://docs.aws.amazon.com/opsworks/latest/userguide/welcome_opscm.html