Skip to content

Instantly share code, notes, and snippets.

@ericcalabretta
Last active April 24, 2020 13:54
Show Gist options
  • Save ericcalabretta/3e701d128ec0dcb21d0c6c78635fcb90 to your computer and use it in GitHub Desktop.
Save ericcalabretta/3e701d128ec0dcb21d0c6c78635fcb90 to your computer and use it in GitHub Desktop.
Configure your workstation

Step 1: Configure your workstation to talk to chef-server

First you'll need to install Chef-Workstation on your laptop. This includes all the tools you need to use Chef.

https://downloads.chef.io/chef-workstation/0.17.5

Test your chef-workstation install with chef --version command.

Chef Workstation version: 0.7.4
Chef Infra Client version: 15.1.36
Chef InSpec version: 4.7.3
Test Kitchen version: 2.2.5
Foodcritic version: 16.1.1
Cookstyle version: 5.0.0

Chef-Workstation includes the knife command line, which lets you interface with Chef-Server.

Add a config file at.chef/config.rb.

You'll need to set the following:

chef_server_url, the FQDN to your chef-serve with /organizations/org-name Mine was demo-org.

client_key, Full path to your client key no ~/ this was created in step 5--filename /tmp/ericc.pem when you created your user on the Chef-Server

node name, this is the username you created ericc

chef_server_url 'https://FQDNgoesHERE.com/organizations/demo-org'  
client_key '/Full/PathGoesHere/.chef/ericc.pem'
node_name 'ericc'

Step 2: Test knife from your laptop to chef-server

We need to grab the self-signed cert & add it to .chef/trusted_certs

knife ssl fetch

Now we can validate the Cert is valid

knife ssl check

Connecting to host FQDN:443
Successfully verified certificates from `FQDN

You can also confirm the user we created earlier.

knife user list
ericc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment