Home CentOS CentOS: Install Chef server on CentOS 7, workstation on Windows + managing a node

CentOS: Install Chef server on CentOS 7, workstation on Windows + managing a node

by Kliment Andreev
8K views

In this post I’ll explain how to install a Chef server on CentOS 7 server. A Chef server is usually managed by a Chef workstation and the servers that we manage with the workstation via the server are called Chef nodes. For more detailed info, go to https://learn.chef.io. So, we’ll install Chef server on CentOS 7, a Chef workstation on Windows 10 and bootstrap a Chef node on CentOS 7 and a Chef node on Windows 2012R2. Then, we’ll create a cookbook that will do something and then explain a couple of commands that are commonly used. The hostnames in this post are chef-server.chef.local, chef-wks.chef.local, chef-node.chef.local for the CentOS node and chef-node-win for the Windows node.

Chef server

Go to https://downloads.chef.io/chef-server and download the RPM for Red Hat Linux. You can use the root user to install the server or some other user with sudo rights. Once the RPM file has been transferred, install the server.

cd
sudo rpm -Uvh chef-server-core-12.17.15-1.el7.x86_64.rpm

Most likely, you’ll file-name will differ because Chef releases updates quite often.
Once installed, do an initial configuration.

sudo chef-server-ctl reconfigure

We need to create an admin user for Chef. This admin users is a Chef user, not an OS user.

sudo chef-server-ctl user-create chef-admin Chef Admin [email protected] SomePassword --filename chef-admin.pem

This command will create an admin user called chef-admin with first name Chef and last name Admin. The e-mail of the chef-admin user is [email protected] and the password is SomePassword. The command will also create a certificate that we will use to log to the server from the workstation. So, the PEM file is very important. If everything is OK, you’ll get your prompt back without any notifications.
Now that we have the user created, we’ll create an organization. An organization is a top-level entity for the roles, groups and nodes. With the same command, we’ll add the user that we just created as a member of the organization.

sudo chef-server-ctl org-create chef-org "Chef Organization, Inc." --association_user chef-admin --filename chef-org.pem

This command creates a Chef organization called chef-org, a detailed description for the organization is “Chef Organization, Inc.” and we associate the user chef-admin with the organization. The PEM file is used for validation as well, but we won’t need it. It was used in versions of Chef before v12 to authenticate users. Make sure that the organization’s name is all lower case, otherwise you’ll get an error.
At this point, we have the user and the organization created. This should be enough to do everything we need, but we’ll install a GUI called Chef Manage that can ease some of the admin tasks.

sudo chef-server-ctl install chef-manage 

Once installed, we have to accept the license. Type yes and hit Enter when prompted.

sudo chef-manage-ctl reconfigure

Once completed, you can access the server over https (e.g. https://chef_server_name_or_ip). Use the same username and password from the above. It looks like this.

We are done with the server.

Chef workstation

Chef servers are managed from workstations. We’ll use Windows 10. The installation is very simple. Go to this link and download the client (Chef DK – Development Kit) for Windows 10. Use the defaults to install. Once installed, you’ll see a shortcut on your desktop.


This will start PowerShell in admin mode. If your workstation was never configured for PowerShell, you’ll see something like this.


Type:

Set-ExecutionPolicy RemoteSigned

and say Y and enter.
Close the window and open it again. This time you’ll be greeted with Ohai, welcome to ChefDK.
OK, so now we have the client installed, but how do we talk to the server? We need some sort of a home folder where all of our cookbooks, recipes and config files will be stored. I’ll use a folder called chef that’s under the Documents folder for this.

cd ~\Documents
mkdir -p chef\.chef

We created another subfolder .chef, where we’ll keep our certificate. That’s the certificate that we generated when we created the chef-admin user. Let’s copy that file from the server to the workstation. Mind that the user username in the command below is the user that I’ve used to run the Chef install. If you used root to install the Chef server, replace the username with root.

scp username@chef-server:~username/chef-admin.pem chef/.chef/chef-admin.pem

This command will add the Chef server (hostname: chef-server) to the list of known hosts under C:\users\\.ssh folder and copy the certificate PEM file under C:\users\\Documents\chef\.chef folder. Let’s create a folder where we’ll store our cookbooks.

cd ~\Documents\chef
mkdir cookbooks

Now, create a file called knife.rb with the following content and save it under chef\.chef folder. Or, if you have the Chef Manage GUI, you can download the same file if you go to Administration from the menu, then select your Organization and then Generate Knife Config from the left side-bar.

current_dir = File.dirname(__FILE__)
log_level                 :info
log_location              STDOUT
node_name                 "chef-admin"
client_key                "#{current_dir}/chef-admin.pem"
chef_server_url           "https://chef-server.chef.local/organizations/chef-org"
cookbook_path             ["#{current_dir}/../cookbooks"]

Under the chef\.chef folder, you should have two files now: chef-admin.pem certificate and knife.rb config file. Let’s verify if we are all set now.

cd ~\Documents\chef
knife ssl fetch

You should see something like this. This will import the nginx server certificate to your local cert store.

WARNING: Certificates from chef-server.chef.local will be fetched and placed in your trusted_cert
directory (c:\users\kliment.andreev\documents\chef\.chef\trusted_certs).

Knife has no means to verify these are the correct certificates. You should
verify the authenticity of these certificates after downloading.

Adding certificate for chef-server_chef_local in c:\users\kliment.andreev\documents\chef\.chef\trusted_certs/chef-server_chef_local.crt

OK. Then, check.

cd ~\Documents\chef
knife ssl check

It should say something like this.

Connecting to host chef-server.chef.local:443
Successfully verified certificates from `chef-server.chef.local'

This is also a good sign that everything works fine. Sometimes ssl fetch and ssl check pass, but this one fails. In that case, make sure that the node_name directive in knife.rb is your actual chef-admin name.

cd ~\Documents\chef
knife client list

The output should be something like chef-org-validator. If you noticed, I used cd ~\Documents\chef a lot. Chef is kind of picky, so it is important to know where are you in the folder tree when running the commands. Always make sure you are in your home directory, cd ~\Documents\chef before running the knife and chef commands.

Configure git

Before we generate our first cookbook, we’ll have to configure git. Do that with the following commands.

git config --global user.email "[email protected]"
git config --global user.name "Your Name"

Test cookbook

Without going into any explanations, we’ll create a test cookbook, upload it to the server and then list the server for available cookbooks.

cd ~\Documents\chef
chef generate cookbook cookbooks/test
knife cookbook upload test
knife cookbook list

If the output looks like this, you are OK.

PS C:\Users\Kliment.ANDREEV\documents\chef> chef generate cookbook cookbooks/test
Generating cookbook test
- Ensuring correct cookbook file content
- Committing cookbook files to git
- Ensuring delivery configuration
- Ensuring correct delivery build cookbook content
- Adding delivery configuration to feature branch
- Adding build cookbook to feature branch
- Merging delivery content feature branch to master

Your cookbook is ready. Type `cd cookbooks/test` to enter it.

There are several commands you can run to get started locally developing and testing your cookbook.
Type `delivery local --help` to see a full list.

Why not start by writing a test? Tests for the default recipe are stored at:

test/smoke/default/default_test.rb

If you'd prefer to dive right in, the default recipe can be found at:

recipes/default.rb

PS C:\Users\Kliment.ANDREEV\documents\chef> knife cookbook upload test
Uploading test         [0.1.0]
Uploaded 1 cookbook.

PS C:\Users\Kliment.ANDREEV\documents\chef> knife cookbook list
test   0.1.0

PS C:\Users\Kliment.ANDREEV\documents\chef>

Chef node

From the workstation execute this line to install the node.

knife bootstrap chef-node --ssh-user username --sudo -N chef-node.chef.local

Use a username that can su as root, otherwise the command will fail. You have to enter the password twice. Once for the username prompt and the second time for the sudo. The output should look like this. Click to expand.

Creating new client for chef-node.chef.local
Creating new node for chef-node.chef.local
Connecting to chef-node
username@chef-node's password:
chef-node 
chef-node We trust you have received the usual lecture from the local System
chef-node Administrator. It usually boils down to these three things:
chef-node 
chef-node     #1) Respect the privacy of others.
chef-node     #2) Think before you type.
chef-node     #3) With great power comes great responsibility.
chef-node 
chef-node knife sudo password: 
Enter your password: 
chef-node 
chef-node -----> Installing Chef Omnibus (-v 13)
chef-node downloading https://omnitruck-direct.chef.io/chef/install.sh
chef-node   to file /tmp/install.sh.2931/install.sh
chef-node trying wget...
chef-node el 7 x86_64
chef-node Getting information for chef stable 13 for el...
chef-node downloading https://omnitruck-direct.chef.io/stable/chef/metadata?v=13&p=el&pv=7&m=x86_64
chef-node   to file /tmp/install.sh.2944/metadata.txt
chef-node trying wget...
chef-node sha1   037a61a5d9c89d9b71d4c4f6256f45ed422a73ee
chef-node sha256 18826690ac2c7e5f16a21d898ed77be7d78fd2d84bc2a71b4506ee480876bc4b
chef-node url    https://packages.chef.io/files/stable/chef/13.6.4/el/7/chef-13.6.4-1.el7.x86_64.rpm
chef-node version        13.6.4
chef-node downloaded metadata file looks valid...
chef-node downloading https://packages.chef.io/files/stable/chef/13.6.4/el/7/chef-13.6.4-1.el7.x86_64.rpm
chef-node   to file /tmp/install.sh.2944/chef-13.6.4-1.el7.x86_64.rpm
chef-node trying wget...
chef-node Comparing checksum with sha256sum...
chef-node Installing chef 13
chef-node installing with rpm...
chef-node warning: /tmp/install.sh.2944/chef-13.6.4-1.el7.x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID 83ef826a: NOKEY
chef-node Preparing...                                                            (1################################# [100%]
chef-node Updating / installing...
chef-node    1:chef-13.6.4-1.el7                                                  ( ################################# [100%]
chef-node Thank you for installing Chef!
chef-node Starting the first Chef Client run...
chef-node Starting Chef Client, version 13.6.4
chef-node resolving cookbooks for run list: []
chef-node Synchronizing Cookbooks:
chef-node Installing Cookbook Gems:
chef-node Compiling Cookbooks...
chef-node [2018-01-20T08:33:15-08:00] WARN: Node chef-node.chef.local has an empty run list.
chef-node Converging 0 resources
chef-node 
chef-node Running handlers:
chef-node Running handlers complete
chef-node Chef Client finished, 0/0 resources updated in 08 seconds

Windows requires port 5985 (WinRM) to be opened, so make sure you allow this port, especially if the Chef server and the Chef Windows node are not in the same domain. To test the connection, do:

knife wsman test chef-node-win --manual-list

The output should be like this.

Connected successfully to chef-node-win at http://node-win:5985/wsman.

For some reason, I wasn’t able to install Chef node on Windows using an admin account that I’ve created. I was getting authentication errors. Once I used the built-in Administrator account, everything went fine. This is how to install Chef on Windows.

knife bootstrap windows winrm chef-node-win.chef.local --winrm-user Administrator --winrm-password MyPassword -N node-win.chef.local

And if everything is OK, you’ll see the output. Click to expand.

Creating new client for chef-node-win.chef.local
Creating new node for chef-node-win.chef.local

Waiting for remote response before bootstrap.chef-node-win.chef.local . 
chef-node-win.chef.local Response received.
Remote node responded after 0.0 minutes.
Bootstrapping Chef on chef-node-win.chef.local
chef-node-win.chef.local Rendering "C:\Users\ADMINI~1\AppData\Local\Temp\bootstrap-35815-1516539477.bat" chunk 1 
chef-node-win.chef.local Rendering "C:\Users\ADMINI~1\AppData\Local\Temp\bootstrap-35815-1516539477.bat" chunk 2 
chef-node-win.chef.local Rendering "C:\Users\ADMINI~1\AppData\Local\Temp\bootstrap-35815-1516539477.bat" chunk 3 
chef-node-win.chef.local Rendering "C:\Users\ADMINI~1\AppData\Local\Temp\bootstrap-35815-1516539477.bat" chunk 4 
chef-node-win.chef.local Rendering "C:\Users\ADMINI~1\AppData\Local\Temp\bootstrap-35815-1516539477.bat" chunk 5 
chef-node-win.chef.local Rendering "C:\Users\ADMINI~1\AppData\Local\Temp\bootstrap-35815-1516539477.bat" chunk 6 
chef-node-win.chef.local Rendering "C:\Users\ADMINI~1\AppData\Local\Temp\bootstrap-35815-1516539477.bat" chunk 7 
chef-node-win.chef.local Rendering "C:\Users\ADMINI~1\AppData\Local\Temp\bootstrap-35815-1516539477.bat" chunk 8 
chef-node-win.chef.local Checking for existing directory "C:\chef"...
chef-node-win.chef.local Existing directory not found, creating.
chef-node-win.chef.local 
chef-node-win.chef.local C:\Users\Administrator>(
chef-node-win.chef.local echo.url = WScript.Arguments.Named("url")  
chef-node-win.chef.local  echo.path = WScript.Arguments.Named("path")  
chef-node-win.chef.local  echo.proxy = null  
chef-node-win.chef.local  echo.'* Vaguely attempt to handle file:// scheme urls by url unescaping and switching all  
chef-node-win.chef.local  echo.'* / into .  Also assume that file:/// is a local absolute path and that file://<foo>  
chef-node-win.chef.local  echo.'* is possibly a network file path.  
chef-node-win.chef.local  echo.If InStr(url, "file://") = 1 Then  
chef-node-win.chef.local  echo.url = Unescape(url)  
chef-node-win.chef.local  echo.If InStr(url, "file:///") = 1 Then  
chef-node-win.chef.local  echo.sourcePath = Mid(url, Len("file:///") + 1)  
chef-node-win.chef.local  echo.Else 
chef-node-win.chef.local  echo.sourcePath = Mid(url, Len("file:") + 1)  
chef-node-win.chef.local  echo.End If  
chef-node-win.chef.local  echo.sourcePath = Replace(sourcePath, "/", "\")  
chef-node-win.chef.local  echo. 
chef-node-win.chef.local  echo.Set objFSO = CreateObject("Scripting.FileSystemObject")  
chef-node-win.chef.local  echo.If objFSO.Fileexists(path) Then objFSO.DeleteFile path  
chef-node-win.chef.local  echo.objFSO.CopyFile sourcePath, path, true  
chef-node-win.chef.local  echo.Set objFSO = Nothing  
chef-node-win.chef.local  echo. 
chef-node-win.chef.local  echo.Else 
chef-node-win.chef.local  echo.Set objXMLHTTP = CreateObject("MSXML2.ServerXMLHTTP")  
chef-node-win.chef.local  echo.Set wshShell = CreateObject( "WScript.Shell" )  
chef-node-win.chef.local  echo.Set objUserVariables = wshShell.Environment("USER")  
chef-node-win.chef.local  echo. 
chef-node-win.chef.local  echo.rem http proxy is optional  
chef-node-win.chef.local  echo.rem attempt to read from HTTP_PROXY env var first  
chef-node-win.chef.local  echo.On Error Resume Next  
chef-node-win.chef.local  echo. 
chef-node-win.chef.local  echo.If NOT (objUserVariables("HTTP_PROXY") = "") Then  
chef-node-win.chef.local  echo.proxy = objUserVariables("HTTP_PROXY")  
chef-node-win.chef.local  echo. 
chef-node-win.chef.local  echo.rem fall back to named arg  
chef-node-win.chef.local  echo.ElseIf NOT (WScript.Arguments.Named("proxy") = "") Then  
chef-node-win.chef.local  echo.proxy = WScript.Arguments.Named("proxy")  
chef-node-win.chef.local  echo.End If  
chef-node-win.chef.local  echo. 
chef-node-win.chef.local  echo.If NOT isNull(proxy) Then  
chef-node-win.chef.local  echo.rem setProxy method is only available on ServerXMLHTTP 6.0+  
chef-node-win.chef.local  echo.Set objXMLHTTP = CreateObject("MSXML2.ServerXMLHTTP.6.0")  
chef-node-win.chef.local  echo.objXMLHTTP.setProxy 2, proxy  
chef-node-win.chef.local  echo.End If  
chef-node-win.chef.local  echo. 
chef-node-win.chef.local  echo.On Error Goto 0  
chef-node-win.chef.local  echo. 
chef-node-win.chef.local  echo.objXMLHTTP.open "GET", url, false  
chef-node-win.chef.local  echo.objXMLHTTP.send() 
chef-node-win.chef.local  echo.If objXMLHTTP.Status = 200 Then  
chef-node-win.chef.local  echo.Set objADOStream = CreateObject("ADODB.Stream")  
chef-node-win.chef.local  echo.objADOStream.Open 
chef-node-win.chef.local  echo.objADOStream.Type = 1  
chef-node-win.chef.local  echo.objADOStream.Write objXMLHTTP.ResponseBody  
chef-node-win.chef.local  echo.objADOStream.Position = 0  
chef-node-win.chef.local  echo.Set objFSO = Createobject("Scripting.FileSystemObject")  
chef-node-win.chef.local  echo.If objFSO.Fileexists(path) Then objFSO.DeleteFile path  
chef-node-win.chef.local  echo.Set objFSO = Nothing  
chef-node-win.chef.local  echo.objADOStream.SaveToFile path  
chef-node-win.chef.local  echo.objADOStream.Close 
chef-node-win.chef.local  echo.Set objADOStream = Nothing  
chef-node-win.chef.local  echo.End If  
chef-node-win.chef.local  echo.Set objXMLHTTP = Nothing  
chef-node-win.chef.local  echo.End If 
chef-node-win.chef.local ) 1>C:\chef\wget.vbs 
chef-node-win.chef.local 
chef-node-win.chef.local C:\Users\Administrator>(
chef-node-win.chef.local echo.param( 
chef-node-win.chef.local  echo.   [String] $remoteUrl,  
chef-node-win.chef.local  echo.   [String] $localPath  
chef-node-win.chef.local  echo.) 
chef-node-win.chef.local  echo. 
chef-node-win.chef.local  echo.$ProxyUrl = $env:http_proxy;  
chef-node-win.chef.local  echo.$webClient = new-object System.Net.WebClient;  
chef-node-win.chef.local  echo. 
chef-node-win.chef.local  echo.if ($ProxyUrl -ne '') {  
chef-node-win.chef.local  echo.  $WebProxy = New-Object System.Net.WebProxy($ProxyUrl,$true)  
chef-node-win.chef.local  echo.  $WebClient.Proxy = $WebProxy  
chef-node-win.chef.local  echo.} 
chef-node-win.chef.local  echo. 
chef-node-win.chef.local  echo.$webClient.DownloadFile($remoteUrl, $localPath); 
chef-node-win.chef.local ) 1>C:\chef\wget.ps1 
chef-node-win.chef.local 
chef-node-win.chef.local C:\Users\Administrator>(
chef-node-win.chef.local  
chef-node-win.chef.local   
chef-node-win.chef.local  
chef-node-win.chef.local ) 
chef-node-win.chef.local Detected Windows Version 6.3 Build 9600
chef-node-win.chef.local 
chef-node-win.chef.local C:\Users\Administrator>goto Version6.3 
chef-node-win.chef.local 
chef-node-win.chef.local C:\Users\Administrator>goto Version6.2 
chef-node-win.chef.local 
chef-node-win.chef.local C:\Users\Administrator>goto architecture_select 
chef-node-win.chef.local 
chef-node-win.chef.local C:\Users\Administrator>IF "AMD64" == "x86" IF not defined PROCESSOR_ARCHITEW6432 
chef-node-win.chef.local 
chef-node-win.chef.local C:\Users\Administrator>goto install 
chef-node-win.chef.local Checking for existing downloaded package at "C:\Users\ADMINI~1\AppData\Local\Temp\chef-client-latest.msi"
chef-node-win.chef.local No existing downloaded packages to delete.
chef-node-win.chef.local Attempting to download client package using PowerShell if available...
chef-node-win.chef.local powershell.exe -ExecutionPolicy Unrestricted -InputFormat None -NoProfile -NonInteractive -File  C:\chef\wget.ps1 "https://www.chef.io/chef/download?p=windows&pv=2012&m=x86_64&DownloadContext=PowerShell&v=13" "C:\Users\ADMINI~1\AppData\Local\Temp\chef-client-latest.msi"
chef-node-win.chef.local Download via PowerShell succeeded.
chef-node-win.chef.local Installing downloaded client package...
chef-node-win.chef.local 
chef-node-win.chef.local C:\Users\Administrator>msiexec /qn /log "C:\Users\ADMINI~1\AppData\Local\Temp\chef-client-msi20931.log" /i "C:\Users\ADMINI~1\AppData\Local\Temp\chef-client-latest.msi" 
chef-node-win.chef.local Successfully installed Chef Client package.
chef-node-win.chef.local Installation completed successfully
chef-node-win.chef.local Writing validation key...
chef-node-win.chef.local Validation key written.
chef-node-win.chef.local 
chef-node-win.chef.local C:\Users\Administrator>mkdir C:\chef\trusted_certs 
chef-node-win.chef.local 
chef-node-win.chef.local C:\Users\Administrator>(
chef-node-win.chef.local echo.-----BEGIN CERTIFICATE-----  
chef-node-win.chef.local  echo.MIID6zCCAtOgAwIBAgIBADANBgkqhkiG9w0BAQsFADBRMQswCQYDVQQGEwJVUzEQ 
chef-node-win.chef.local  echo.MA4GA1UECgwHWW91Q29ycDETMBEGA1UECwwKT3BlcmF0aW9uczEbMBkGA1UEAwwS 
chef-node-win.chef.local  echo.Y2hlZi5hbmRyZWV2LmxvY2FsMB4XDTE4MDExNDIyMjkwMloXDTI4MDExMjIyMjkw 
chef-node-win.chef.local  echo.MlowUTELMAkGA1UEBhMCVVMxEDAOBgNVBAoMB1lvdUNvcnAxEzARBgNVBAsMCk9w 
chef-node-win.chef.local  echo.ZXJhdGlvbnMxGzAZBgNVBAMMEmNoZWYuYW5kcmVldi5sb2NhbDCCASIwDQYJKoZI 
chef-node-win.chef.local  echo.hvcNAQEBBQADggEPADCCAQoCggEBAKiyl7i+TpCdwvWtAnpcktKL5BKm/zonS87f 
chef-node-win.chef.local  echo.mm61beXd7CDJifcpllinq/b/96r6872odbmVYHZ3uwGhX3+95AlFOOZiM+Ze08Ds 
chef-node-win.chef.local  echo.574Rj53Xz+ASSCcZsbwdAPc//dBs67GndNjgH3iy2bAFxjOkPJJX9bBZoKhYEXRp 
chef-node-win.chef.local  echo.9xEdUEQwj3W0g92b3sDx2gDSOXgP43g+vqRLjUiCAmRmCmgFkMkb9Xitxn3CXXiM 
chef-node-win.chef.local  echo.KDSUDiR1CA8FbrzIZ/O4ahB9UMeGvUEUkD2nN3BcWphXYWz5sVxxVBlqmyK51EIa 
chef-node-win.chef.local  echo.lUd/lKw0xw2iYPUAkjxPdr7djJGgEQqXiYC3/r4v4w3RAdVY5jUCAwEAAaOBzTCB 
chef-node-win.chef.local  echo.yjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBT+SJ3clvJyuQqFPpcaCWX7QB8i 
chef-node-win.chef.local  echo.HzAdBgNVHREEFjAUghJjaGVmLmFuZHJlZXYubG9jYWwweQYDVR0jBHIwcIAU/kid 
chef-node-win.chef.local  echo.3JbycrkKhT6XGgll+0AfIh+hVaRTMFExCzAJBgNVBAYTAlVTMRAwDgYDVQQKDAdZ 
chef-node-win.chef.local  echo.b3VDb3JwMRMwEQYDVQQLDApPcGVyYXRpb25zMRswGQYDVQQDDBJjaGVmLmFuZHJl 
chef-node-win.chef.local  echo.ZXYubG9jYWyCAQAwDQYJKoZIhvcNAQELBQADggEBAImSEMXEX+rqbRd3ireoFbkY 
chef-node-win.chef.local  echo.b97RmbsXjcwmA6MuAIZIyoFw/DwRUBrahrlLhXEAgeDWPlgS2xGniLJxdGx5a0ca 
chef-node-win.chef.local  echo.pz/8hC4RQuIq4kOWhkvcFTms/hPXIVSyBcYEt4FFkrhOeIDxwoBrEfIFncXC8DiL 
chef-node-win.chef.local  echo.IdPUH1DZeJLx8T7zCrUjFpPG3IL65HXIsteXaGNsJtKoRdDprPIIGlUlw72n5M9Y 
chef-node-win.chef.local  echo.Y8VoH6s5roky3OemhOIqPzgK/fVhY3cQWivRdDNe7M2hT03TmwpvbFs0Emydaa+Q 
chef-node-win.chef.local  echo.E+QroZpUvQZK6I6gtN1kG5K8M+HBNnx2NavKj8YjuQokeJYEF6Fb7dhGz5BMgPU=  
chef-node-win.chef.local  echo.-----END CERTIFICATE----- 
chef-node-win.chef.local ) 1>C:\chef/trusted_certs/chef_andreev_local.crt 
chef-node-win.chef.local 
chef-node-win.chef.local C:\Users\Administrator>(
chef-node-win.chef.local echo.chef_server_url  "https://chef.andreev.local/organizations/iandreev"  
chef-node-win.chef.local  echo.validation_client_name "chef-validator"  
chef-node-win.chef.local  echo.file_cache_path   "c:/chef/cache"  
chef-node-win.chef.local  echo.file_backup_path  "c:/chef/backup"  
chef-node-win.chef.local  echo.cache_options     ({:path => "c:/chef/cache/checksums", :skip_expires => true})  
chef-node-win.chef.local  echo.node_name "chef-node-win.chef.local"  
chef-node-win.chef.local  echo.log_level        :info  
chef-node-win.chef.local  echo.log_location       STDOUT  
chef-node-win.chef.local  echo.trusted_certs_dir "c:/chef/trusted_certs" 
chef-node-win.chef.local ) 1>C:\chef\client.rb 
chef-node-win.chef.local 
chef-node-win.chef.local C:\Users\Administrator>(echo.{"run_list":[]}) 1>C:\chef\first-boot.json 
chef-node-win.chef.local Starting chef to bootstrap the node...
chef-node-win.chef.local 
chef-node-win.chef.local C:\Users\Administrator>SET "PATH=C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\ruby\bin;C:\opscode\chef\bin;C:\opscode\chef\embedded\bin" 
chef-node-win.chef.local 
chef-node-win.chef.local C:\Users\Administrator>chef-client -c c:/chef/client.rb -j c:/chef/first-boot.json 
chef-node-win.chef.local Starting Chef Client, version 13.6.4
chef-node-win.chef.local 
chef-node-win.chef.local [2018-01-21T07:58:38-05:00] INFO: *** Chef 13.6.4 ***
chef-node-win.chef.local [2018-01-21T07:58:38-05:00] INFO: Platform: x64-mingw32
chef-node-win.chef.local [2018-01-21T07:58:38-05:00] INFO: Chef-client pid: 2936
chef-node-win.chef.local [2018-01-21T07:58:38-05:00] INFO: The plugin path C:\chef\ohai\plugins does not exist. Skipping...
chef-node-win.chef.local [2018-01-21T07:58:49-05:00] INFO: Setting the run_list to [] from CLI options
chef-node-win.chef.local [2018-01-21T07:58:49-05:00] INFO: Run List is []
chef-node-win.chef.local [2018-01-21T07:58:49-05:00] INFO: Run List expands to []
chef-node-win.chef.local [2018-01-21T07:58:49-05:00] INFO: Starting Chef Run for chef-node-win.chef.local
chef-node-win.chef.local [2018-01-21T07:58:49-05:00] INFO: Running start handlers
chef-node-win.chef.local [2018-01-21T07:58:49-05:00] INFO: Start handlers complete.
chef-node-win.chef.local [2018-01-21T07:58:49-05:00] INFO: Error while reporting run start to Data Collector. URL: https://chef.andreev.local/organizations/iandreev/data-collector Exception: 404 -- 404 "Not Found"  (This is normal if you do not have Chef Automate)
chef-node-win.chef.local resolving cookbooks for run list: []
chef-node-win.chef.local [2018-01-21T07:58:49-05:00] INFO: Loading cookbooks []
chef-node-win.chef.local Synchronizing Cookbooks:
chef-node-win.chef.local Installing Cookbook Gems:
chef-node-win.chef.local Compiling Cookbooks...
chef-node-win.chef.local [2018-01-21T07:58:49-05:00] WARN: Node chef-node-win.chef.local has an empty run list.
chef-node-win.chef.local Converging 0 resources
chef-node-win.chef.local 
chef-node-win.chef.local [2018-01-21T07:58:50-05:00] INFO: Chef Run complete in 0.437135 seconds
chef-node-win.chef.local 
chef-node-win.chef.local Running handlers:
chef-node-win.chef.local [2018-01-21T07:58:50-05:00] INFO: Running report handlers
chef-node-win.chef.local Running handlers complete
chef-node-win.chef.local [2018-01-21T07:58:50-05:00] INFO: Report handlers complete
chef-node-win.chef.local Chef Client finished, 0/0 resources updated in 11 seconds

Check the details for each node.

knife node show chef-node.chef.local
Node Name:   chef-node.chef.local
Environment: _default
FQDN:        chef-node.chef.local
IP:          192.168.1.16
Run List:    
Roles:       
Recipes:     
Platform:    centos 7.2.1511
Tags:    
    
knife node show chef-node-win.chef.local
Node Name:   chef-node-win.chef.local
Environment: _default
FQDN:        chef-node-win
IP:          192.168.1.20
Run List:    
Roles:       
Recipes:     
Platform:    windows 6.3.9600
Tags:        

Related Articles

2 comments

bijujo July 11, 2019 - 5:38 PM

Thank you for the post. I am trying to automate the installation of chef server, probably using EC2 user data. Is there any way to run “chef-server-ctl reconfigure” unattended?

Kliment Andreev July 12, 2019 - 6:38 AM

Try

chef-server-ctl reconfigure --accept

Leave a Comment

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More