Contributors20 minutesRecall that any computer that's managed by a Chef server is called a node, and that chef-client is the command that applies the policy defined by your cookbooks to a node. We call the process that installs chef-client on a node and the initial check-in to the Chef server bootstrapping the node.
In this part you'll bootstrap your node and execute the learn_chef_iis cookbook on it.
1. Run the bootstrap command
knife bootstrap is the command you use to bootstrap a node. As part of the knife bootstrap command, you specify how to connect to the instance and what cookbooks your node should run.
Run this command to bootstrap your node. Replace ADDRESS with your remote node's external address, USER with your username, and PASSWORD with your password.
- If you're bootstrapping a Microsoft Azure instance
Later in this module, you'll use Chef's ability to search node metadata to run chef-client a second time on your node. That step will require your node to have an attribute that contains its public hostname or IP address.
Because Azure does not provide metadata about an instance's public hostname or IP address, you need to set it manually during the bootstrap process.
If you're using an Azure instance as your node, append the --json-attributes argument to the end of your knife bootstrap command in this format:
Terminal: ~/learn-chef
| --json-attributes '{"cloud": {"public_ip": "NODE_PUBLIC_IP_ADDRESS"}}'
|
For example:
Terminal: ~/learn-chef
| --json-attributes '{"cloud": {"public_ip": "13.82.139.157"}}'
|
If your workstation is running Windows, you need to run the bootstrap command differently.
Although we recommend that you run Chef commands from Chef Workstation command prompt, for this part we recommend that you use a standard PowerShell window. GitHub issue
From PowerShell, create a variable to hold the string as a JSON object.
Windows PowerShell: ~\learn-chef
PS > | $public_ip = '{"cloud": {"public_ip": "13.82.139.157"}}' | ConvertTo-Json
|
When you run the bootstrap command, pass the --json-attributes argument like this.
Windows PowerShell: ~\learn-chef
| --json-attributes $public_ip
|
The --node-name argument uniquely identifies the node with the Chef server. Its value can be whatever you want. If you previously used the name node1-windows to bootstrap a different node, you can respond with 'Y' to overwrite that node's entry on your Chef server. Alternatively, you can choose a different name or remove the previous node from your Chef server.
Terminal: ~/learn-chef
$ | knife bootstrap windows winrm ADDRESS --winrm-user USER --winrm-password 'PASSWORD' --node-name node1-windows --run-list 'recipe[learn_chef_iis]'
|
Here's an example:
Terminal: ~/learn-chef
$ | knife bootstrap windows winrm 52.91.187.161 --winrm-user Administrator --winrm-password '7pXySo%!Cz' --node-name node1-windows --run-list 'recipe[learn_chef_iis]'Creating new client for node1-windowsCreating new node for node1-windowsRemote node responded after 0.0 minutes.Bootstrapping Chef on 52.91.187.161 Waiting for remote response before bootstrap.52.91.187.161 . 52.91.187.161 Response received.52.91.187.161 Rendering "C:\Users\ADMINI~1\AppData\Local\Temp\bootstrap-4325-1525361524.bat" chunk 1 52.91.187.161 Rendering "C:\Users\ADMINI~1\AppData\Local\Temp\bootstrap-4325-1525361524.bat" chunk 2 52.91.187.161 Rendering "C:\Users\ADMINI~1\AppData\Local\Temp\bootstrap-4325-1525361524.bat" chunk 3 52.91.187.161 Rendering "C:\Users\ADMINI~1\AppData\Local\Temp\bootstrap-4325-1525361524.bat" chunk 4 52.91.187.161 Rendering "C:\Users\ADMINI~1\AppData\Local\Temp\bootstrap-4325-1525361524.bat" chunk 5 52.91.187.161 Rendering "C:\Users\ADMINI~1\AppData\Local\Temp\bootstrap-4325-1525361524.bat" chunk 6 52.91.187.161 Rendering "C:\Users\ADMINI~1\AppData\Local\Temp\bootstrap-4325-1525361524.bat" chunk 7 52.91.187.161 Rendering "C:\Users\ADMINI~1\AppData\Local\Temp\bootstrap-4325-1525361524.bat" chunk 8 52.91.187.161 Checking for existing directory "C:\chef"...52.91.187.161 Existing directory not found, creating.52.91.187.161 52.91.187.161 C:\Users\Administrator>(52.91.187.161 echo.url = WScript.Arguments.Named("url") 52.91.187.161 echo.path = WScript.Arguments.Named("path") 52.91.187.161 echo.proxy = null 52.91.187.161 echo.'* Vaguely attempt to handle file:// scheme urls by url unescaping and switching all 52.91.187.161 echo.'* / into . Also assume that file:/// is a local absolute path and that file://<foo> 52.91.187.161 echo.'* is possibly a network file path. 52.91.187.161 echo.If InStr(url, "file://") = 1 Then 52.91.187.161 echo.url = Unescape(url) 52.91.187.161 echo.If InStr(url, "file:///") = 1 Then 52.91.187.161 echo.sourcePath = Mid(url, Len("file:///") + 1) 52.91.187.161 echo.Else 52.91.187.161 echo.sourcePath = Mid(url, Len("file:") + 1) 52.91.187.161 echo.End If 52.91.187.161 echo.sourcePath = Replace(sourcePath, "/", "\") 52.91.187.161 echo. 52.91.187.161 echo.Set objFSO = CreateObject("Scripting.FileSystemObject") 52.91.187.161 echo.If objFSO.Fileexists(path) Then objFSO.DeleteFile path 52.91.187.161 echo.objFSO.CopyFile sourcePath, path, true 52.91.187.161 echo.Set objFSO = Nothing 52.91.187.161 echo. 52.91.187.161 echo.Else 52.91.187.161 echo.Set objXMLHTTP = CreateObject("MSXML2.ServerXMLHTTP") 52.91.187.161 echo.Set wshShell = CreateObject( "WScript.Shell" ) 52.91.187.161 echo.Set objUserVariables = wshShell.Environment("USER") 52.91.187.161 echo. 52.91.187.161 echo.rem http proxy is optional 52.91.187.161 echo.rem attempt to read from HTTP_PROXY env var first 52.91.187.161 echo.On Error Resume Next 52.91.187.161 echo. 52.91.187.161 echo.If NOT (objUserVariables("HTTP_PROXY") = "") Then 52.91.187.161 echo.proxy = objUserVariables("HTTP_PROXY") 52.91.187.161 echo. 52.91.187.161 echo.rem fall back to named arg 52.91.187.161 echo.ElseIf NOT (WScript.Arguments.Named("proxy") = "") Then 52.91.187.161 echo.proxy = WScript.Arguments.Named("proxy") 52.91.187.161 echo.End If 52.91.187.161 echo. 52.91.187.161 echo.If NOT isNull(proxy) Then 52.91.187.161 echo.rem setProxy method is only available on ServerXMLHTTP 6.0+ 52.91.187.161 echo.Set objXMLHTTP = CreateObject("MSXML2.ServerXMLHTTP.6.0") 52.91.187.161 echo.objXMLHTTP.setProxy 2, proxy 52.91.187.161 echo.End If 52.91.187.161 echo. 52.91.187.161 echo.On Error Goto 0 52.91.187.161 echo. 52.91.187.161 echo.objXMLHTTP.open "GET", url, false 52.91.187.161 echo.objXMLHTTP.send() 52.91.187.161 echo.If objXMLHTTP.Status = 200 Then 52.91.187.161 echo.Set objADOStream = CreateObject("ADODB.Stream") 52.91.187.161 echo.objADOStream.Open 52.91.187.161 echo.objADOStream.Type = 1 52.91.187.161 echo.objADOStream.Write objXMLHTTP.ResponseBody 52.91.187.161 echo.objADOStream.Position = 0 52.91.187.161 echo.Set objFSO = Createobject("Scripting.FileSystemObject") 52.91.187.161 echo.If objFSO.Fileexists(path) Then objFSO.DeleteFile path 52.91.187.161 echo.Set objFSO = Nothing 52.91.187.161 echo.objADOStream.SaveToFile path 52.91.187.161 echo.objADOStream.Close 52.91.187.161 echo.Set objADOStream = Nothing 52.91.187.161 echo.End If 52.91.187.161 echo.Set objXMLHTTP = Nothing 52.91.187.161 echo.End If 52.91.187.161 ) 1>C:\chef\wget.vbs 52.91.187.161 52.91.187.161 C:\Users\Administrator>(52.91.187.161 echo.param( 52.91.187.161 echo. [String] $remoteUrl, 52.91.187.161 echo. [String] $localPath 52.91.187.161 echo.) 52.91.187.161 echo. 52.91.187.161 echo.$ProxyUrl = $env:http_proxy; 52.91.187.161 echo.$webClient = new-object System.Net.WebClient; 52.91.187.161 echo. 52.91.187.161 echo.if ($ProxyUrl -ne '') { 52.91.187.161 echo. $WebProxy = New-Object System.Net.WebProxy($ProxyUrl,$true) 52.91.187.161 echo. $WebClient.Proxy = $WebProxy 52.91.187.161 echo.} 52.91.187.161 echo. 52.91.187.161 echo.$webClient.DownloadFile($remoteUrl, $localPath); 52.91.187.161 ) 1>C:\chef\wget.ps1 52.91.187.161 52.91.187.161 C:\Users\Administrator>(52.91.187.161 52.91.187.161 52.91.187.161 52.91.187.161 ) 52.91.187.161 Detected Windows Version 6.3 Build 960052.91.187.161 52.91.187.161 C:\Users\Administrator>goto Version6.3 52.91.187.161 52.91.187.161 C:\Users\Administrator>goto Version6.2 52.91.187.161 52.91.187.161 C:\Users\Administrator>goto architecture_select 52.91.187.161 52.91.187.161 C:\Users\Administrator>IF "AMD64" == "x86" IF not defined PROCESSOR_ARCHITEW6432 52.91.187.161 52.91.187.161 C:\Users\Administrator>goto install 52.91.187.161 Checking for existing downloaded package at "C:\Users\ADMINI~1\AppData\Local\Temp\chef-client-latest.msi"52.91.187.161 No existing downloaded packages to delete.52.91.187.161 Attempting to download client package using PowerShell if available...52.91.187.161 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"52.91.187.161 Download via PowerShell succeeded.52.91.187.161 Installing downloaded client package...52.91.187.161 52.91.187.161 C:\Users\Administrator>msiexec /qn /log "C:\Users\ADMINI~1\AppData\Local\Temp\chef-client-msi26955.log" /i "C:\Users\ADMINI~1\AppData\Local\Temp\chef-client-latest.msi" 52.91.187.161 Successfully installed Chef Client package.52.91.187.161 Installation completed successfully52.91.187.161 Writing validation key...52.91.187.161 Validation key written.52.91.187.161 52.91.187.161 C:\Users\Administrator>mkdir C:\chef\trusted_certs 52.91.187.161 52.91.187.161 C:\Users\Administrator>(52.91.187.161 echo.-----BEGIN CERTIFICATE----- 52.91.187.161 echo.MIIEmTCCA4GgAwIBAgIBADANBgkqhkiG9w0BAQsFADCBgDELMAkGA1UEBhMCVVMx 52.91.187.161 echo.CjAIBgNVBAgMASAxCjAIBgNVBAcMASAxEDAOBgNVBAoMB1lvdUNvcnAxEzARBgNV 52.91.187.161 echo.BAsMCk9wZXJhdGlvbnMxMjAwBgNVBAMMKWVjMi0zNC0yMDctMTI0LTI2LmNvbXB1 52.91.187.161 echo.dGUtMS5hbWF6b25hd3MuY29tMB4XDTE4MDUwMzE1MDYzOVoXDTI4MDQzMDE1MDYz 52.91.187.161 echo.OVowgYAxCzAJBgNVBAYTAlVTMQowCAYDVQQIDAEgMQowCAYDVQQHDAEgMRAwDgYD 52.91.187.161 echo.VQQKDAdZb3VDb3JwMRMwEQYDVQQLDApPcGVyYXRpb25zMTIwMAYDVQQDDCllYzIt 52.91.187.161 echo.MzQtMjA3LTEyNC0yNi5jb21wdXRlLTEuYW1hem9uYXdzLmNvbTCCASIwDQYJKoZI 52.91.187.161 echo.hvcNAQEBBQADggEPADCCAQoCggEBAMdkq+9nBY5aniSM+RpFB/riEdDDB1ixlVS/ 52.91.187.161 echo.m3LfrvZ22b1oxenThgm1oLZTCbDBShfJshrd1MLi4ycEtGY12B2pa8bfPxpLlpc/ 52.91.187.161 echo.TqTpME54i0/jL3H8nRsW2l93gy1t0jxxfyQJtNV2Fx54UPodqCTafLIQdL2NPzx+ 52.91.187.161 echo.EoeBCJR4f0IGqeZfmonKnnvQup043It9mS49USenZXz3iv5nd2RB8nbgRabJ0LBZ 52.91.187.161 echo.5Bs2asTfUFrkseHrT6AgB3TM7Ly4mgEGFChulvO1za8Ra1I3hgdleWYpU/oYCHrU 52.91.187.161 echo.okeA/OlKappmoaAckZpbYPHAOfa3czFEkj2ydXGBqVfa4vpW8HcCAwEAAaOCARow 52.91.187.161 echo.ggEWMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFDdu4FbR2BqX4R8Rl2igt3Cn 52.91.187.161 echo.fT3DMDQGA1UdEQQtMCuCKWVjMi0zNC0yMDctMTI0LTI2LmNvbXB1dGUtMS5hbWF6 52.91.187.161 echo.b25hd3MuY29tMIGtBgNVHSMEgaUwgaKAFDdu4FbR2BqX4R8Rl2igt3CnfT3DoYGG 52.91.187.161 echo.pIGDMIGAMQswCQYDVQQGEwJVUzEKMAgGA1UECAwBIDEKMAgGA1UEBwwBIDEQMA4G 52.91.187.161 echo.A1UECgwHWW91Q29ycDETMBEGA1UECwwKT3BlcmF0aW9uczEyMDAGA1UEAwwpZWMy 52.91.187.161 echo.LTM0LTIwNy0xMjQtMjYuY29tcHV0ZS0xLmFtYXpvbmF3cy5jb22CAQAwDQYJKoZI 52.91.187.161 echo.hvcNAQELBQADggEBAAUkCgaMr2dPKERDneRKjl2o7Jje2GwmsYbeEN5C1UlLnjKq 52.91.187.161 echo.90KSSd+PhFQ6Bbpgk0Z0cr2zseywkyZGAQGbcvvDWSYRWtWFYXN7VjiPzi0LpgHA 52.91.187.161 echo.Xu4KWjlyUZtenR17x7QbtXQy5wZQGVqKhnDJzHnpdgmSNOi/08vVv4LGh1ajY+lI 52.91.187.161 echo.U2ov4yFJJitCZ6c2QT7D7IoJceQFjoPIHURS3cM57gFTVY5G3IUc0nGFsPyR2/Tq 52.91.187.161 echo.xamG+ctDzsL4Nx1hRnxeRAzOBfV4HjXQHJnZEvNM0Pj6j5nIBSgB5XF3qJ2EsoBv 52.91.187.161 echo.mpVNOXYY9+1upZENYuXuPcsHe2gFeiKtCZJMxT8= 52.91.187.161 echo.-----END CERTIFICATE----- 52.91.187.161 ) 1>C:\chef/trusted_certs/ec2-34-207-124-26_compute-1_amazonaws_com.crt 52.91.187.161 52.91.187.161 C:\Users\Administrator>(52.91.187.161 echo.chef_server_url "https://ec2-34-207-124-26.compute-1.amazonaws.com/organizations/4thcoffee" 52.91.187.161 echo.validation_client_name "chef-validator" 52.91.187.161 echo.file_cache_path "c:/chef/cache" 52.91.187.161 echo.file_backup_path "c:/chef/backup" 52.91.187.161 echo.cache_options ({:path => "c:/chef/cache/checksums", :skip_expires => true}) 52.91.187.161 echo.node_name "node1-windows" 52.91.187.161 echo.log_level :info 52.91.187.161 echo.log_location STDOUT 52.91.187.161 echo.trusted_certs_dir "c:/chef/trusted_certs" 52.91.187.161 ) 1>C:\chef\client.rb 52.91.187.161 52.91.187.161 C:\Users\Administrator>(echo.{"run_list":["recipe[learn_chef_iis]"]}) 1>C:\chef\first-boot.json 52.91.187.161 Starting chef to bootstrap the node...52.91.187.161 52.91.187.161 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" 52.91.187.161 52.91.187.161 C:\Users\Administrator>chef-client -c c:/chef/client.rb -j c:/chef/first-boot.json 52.91.187.161 Starting Chef Client, version 13.8.552.91.187.161 52.91.187.161 [2018-05-03T15:32:58+00:00] INFO: *** Chef 13.8.5 ***52.91.187.161 [2018-05-03T15:32:58+00:00] INFO: *** Chef 13.8.5 ***52.91.187.161 [2018-05-03T15:32:58+00:00] INFO: Platform: x64-mingw3252.91.187.161 [2018-05-03T15:32:58+00:00] INFO: Platform: x64-mingw3252.91.187.161 [2018-05-03T15:32:58+00:00] INFO: Chef-client pid: 81252.91.187.161 [2018-05-03T15:32:58+00:00] INFO: Chef-client pid: 81252.91.187.161 [2018-05-03T15:32:58+00:00] INFO: The plugin path C:\chef\ohai\plugins does not exist. Skipping...52.91.187.161 [2018-05-03T15:32:58+00:00] INFO: The plugin path C:\chef\ohai\plugins does not exist. Skipping...52.91.187.161 [2018-05-03T15:33:27+00:00] INFO: Setting the run_list to ["recipe[learn_chef_iis]"] from CLI options52.91.187.161 [2018-05-03T15:33:27+00:00] INFO: Setting the run_list to ["recipe[learn_chef_iis]"] from CLI options52.91.187.161 [2018-05-03T15:33:27+00:00] INFO: Run List is [recipe[learn_chef_iis]]52.91.187.161 [2018-05-03T15:33:27+00:00] INFO: Run List is [recipe[learn_chef_iis]]52.91.187.161 [2018-05-03T15:33:27+00:00] INFO: Run List expands to [learn_chef_iis]52.91.187.161 [2018-05-03T15:33:27+00:00] INFO: Run List expands to [learn_chef_iis]52.91.187.161 [2018-05-03T15:33:27+00:00] INFO: Starting Chef Run for node1-windows52.91.187.161 [2018-05-03T15:33:27+00:00] INFO: Starting Chef Run for node1-windows52.91.187.161 [2018-05-03T15:33:27+00:00] INFO: Running start handlers52.91.187.161 [2018-05-03T15:33:27+00:00] INFO: Running start handlers52.91.187.161 [2018-05-03T15:33:27+00:00] INFO: Start handlers complete.52.91.187.161 [2018-05-03T15:33:27+00:00] INFO: Start handlers complete.52.91.187.161 [2018-05-03T15:33:27+00:00] INFO: Error while reporting run start to Data Collector. URL: https://ec2-34-207-124-26.compute-1.amazonaws.com/organizations/4thcoffee/data-collector Exception: 404 -- 404 "Not Found" (This is normal if you do not have Chef Automate)52.91.187.161 [2018-05-03T15:33:27+00:00] INFO: Error while reporting run start to Data Collector. URL: https://ec2-34-207-124-26.compute-1.amazonaws.com/organizations/4thcoffee/data-collector Exception: 404 -- 404 "Not Found" (This is normal if you do not have Chef Automate)52.91.187.161 resolving cookbooks for run list: ["learn_chef_iis"]52.91.187.161 [2018-05-03T15:33:27+00:00] INFO: Loading cookbooks [learn_chef_iis@0.1.0]52.91.187.161 [2018-05-03T15:33:27+00:00] INFO: Loading cookbooks [learn_chef_iis@0.1.0]52.91.187.161 Synchronizing Cookbooks:52.91.187.161 [2018-05-03T15:33:27+00:00] INFO: Storing updated cookbooks/learn_chef_iis/templates/Default.htm.erb in the cache.52.91.187.161 [2018-05-03T15:33:27+00:00] INFO: Storing updated cookbooks/learn_chef_iis/templates/Default.htm.erb in the cache.52.91.187.161 [2018-05-03T15:33:27+00:00] INFO: Storing updated cookbooks/learn_chef_iis/Berksfile in the cache.52.91.187.161 [2018-05-03T15:33:27+00:00] INFO: Storing updated cookbooks/learn_chef_iis/metadata.rb in the cache.52.91.187.161 [2018-05-03T15:33:27+00:00] INFO: Storing updated cookbooks/learn_chef_iis/recipes/default.rb in the cache.52.91.187.161 [2018-05-03T15:33:27+00:00] INFO: Storing updated cookbooks/learn_chef_iis/.kitchen.yml in the cache.52.91.187.161 [2018-05-03T15:33:27+00:00] INFO: Storing updated cookbooks/learn_chef_iis/LICENSE in the cache.52.91.187.161 [2018-05-03T15:33:27+00:00] INFO: Storing updated cookbooks/learn_chef_iis/Berksfile in the cache.52.91.187.161 [2018-05-03T15:33:27+00:00] INFO: Storing updated cookbooks/learn_chef_iis/metadata.rb in the cache.52.91.187.161 [2018-05-03T15:33:27+00:00] INFO: Storing updated cookbooks/learn_chef_iis/recipes/default.rb in the cache.52.91.187.161 [2018-05-03T15:33:27+00:00] INFO: Storing updated cookbooks/learn_chef_iis/.kitchen.yml in the cache.52.91.187.161 [2018-05-03T15:33:27+00:00] INFO: Storing updated cookbooks/learn_chef_iis/LICENSE in the cache.52.91.187.161 [2018-05-03T15:33:27+00:00] INFO: Storing updated cookbooks/learn_chef_iis/.rubocop.yml in the cache.52.91.187.161 [2018-05-03T15:33:27+00:00] INFO: Storing updated cookbooks/learn_chef_iis/README.md in the cache.52.91.187.161 [2018-05-03T15:33:27+00:00] INFO: Storing updated cookbooks/learn_chef_iis/chefignore in the cache.52.91.187.161 [2018-05-03T15:33:27+00:00] INFO: Storing updated cookbooks/learn_chef_iis/.rubocop.yml in the cache.52.91.187.161 [2018-05-03T15:33:27+00:00] INFO: Storing updated cookbooks/learn_chef_iis/README.md in the cache.52.91.187.161 [2018-05-03T15:33:27+00:00] INFO: Storing updated cookbooks/learn_chef_iis/chefignore in the cache.52.91.187.161 [2018-05-03T15:33:28+00:00] INFO: Storing updated cookbooks/learn_chef_iis/.gitignore in the cache.52.91.187.161 [2018-05-03T15:33:28+00:00] INFO: Storing updated cookbooks/learn_chef_iis/.gitignore in the cache.52.91.187.161 - learn_chef_iis (0.1.0)52.91.187.161 Installing Cookbook Gems:52.91.187.161 Compiling Cookbooks...52.91.187.161 Converging 3 resources52.91.187.161 52.91.187.161 Recipe: learn_chef_iis::default52.91.187.161 * powershell_script[Install IIS] action run[2018-05-03T15:33:28+00:00] INFO: Processing powershell_script[Install IIS] action run (learn_chef_iis::default line 6)52.91.187.161 [2018-05-03T15:33:28+00:00] INFO: Processing powershell_script[Install IIS] action run (learn_chef_iis::default line 6)52.91.187.161 [2018-05-03T15:33:28+00:00] INFO: Processing powershell_script[Guard resource] action run (dynamically defined)52.91.187.161 [2018-05-03T15:33:28+00:00] INFO: Processing powershell_script[Guard resource] action run (dynamically defined)52.91.187.161 52.91.187.161 [execute] WARNING: Windows automatic updating is not enabled. To ensure that your 52.91.187.161 newly-installed role or feature is automatically updated, turn on Windows 52.91.187.161 Update.52.91.187.161 52.91.187.161 Success Restart Needed Exit Code Feature Result 52.91.187.161 ------- -------------- --------- -------------- 52.91.187.161 True No Success {Common HTTP Features, Default Documen... 52.91.187.161 [2018-05-03T15:34:04+00:00] INFO: powershell_script[Install IIS] ran successfully52.91.187.161 [2018-05-03T15:34:04+00:00] INFO: powershell_script[Install IIS] ran successfully52.91.187.161 - execute "C:\Windows\system32\WindowsPowerShell\v1.0\powershell.exe" -NoLogo -NonInteractive -NoProfile -ExecutionPolicy Bypass -InputFormat None -File "C:/Users/ADMINI~1/AppData/Local/Temp/chef-script20180503-812-10m81jm.ps1"52.91.187.161 * windows_service[w3svc] action enable[2018-05-03T15:34:04+00:00] INFO: Processing windows_service[w3svc] action enable (learn_chef_iis::default line 12)52.91.187.161 [2018-05-03T15:34:04+00:00] INFO: Processing windows_service[w3svc] action enable (learn_chef_iis::default line 12)52.91.187.161 (up to date)52.91.187.161 * windows_service[w3svc] action start[2018-05-03T15:34:04+00:00] INFO: Processing windows_service[w3svc] action start (learn_chef_iis::default line 12)52.91.187.161 [2018-05-03T15:34:04+00:00] INFO: Processing windows_service[w3svc] action start (learn_chef_iis::default line 12)52.91.187.161 (up to date)52.91.187.161 * template[c:\inetpub\wwwroot\Default.htm] action create[2018-05-03T15:34:04+00:00] INFO: Processing template[c:\inetpub\wwwroot\Default.htm] action create (learn_chef_iis::default line 16)52.91.187.161 [2018-05-03T15:34:04+00:00] INFO: Processing template[c:\inetpub\wwwroot\Default.htm] action create (learn_chef_iis::default line 16)52.91.187.161 [2018-05-03T15:34:04+00:00] INFO: template[c:\inetpub\wwwroot\Default.htm] created file c:\inetpub\wwwroot\Default.htm52.91.187.161 [2018-05-03T15:34:04+00:00] INFO: template[c:\inetpub\wwwroot\Default.htm] created file c:\inetpub\wwwroot\Default.htm52.91.187.161 52.91.187.161 - create new file c:\inetpub\wwwroot\Default.htm52.91.187.161 [2018-05-03T15:34:04+00:00] INFO: template[c:\inetpub\wwwroot\Default.htm] updated file contents c:\inetpub\wwwroot\Default.htm52.91.187.161 [2018-05-03T15:34:04+00:00] INFO: template[c:\inetpub\wwwroot\Default.htm] updated file contents c:\inetpub\wwwroot\Default.htm52.91.187.161 52.91.187.161 - update content in file c:\inetpub\wwwroot\Default.htm from none to a7298b52.91.187.161 --- c:\inetpub\wwwroot\Default.htm 2018-05-03 15:34:04.000000000 +000052.91.187.161 +++ c:\inetpub\wwwroot/chef-Default20180503-812-1vdajep.htm 2018-05-03 15:34:04.000000000 +000052.91.187.161 @@ -1 +1,6 @@52.91.187.161 +<html>52.91.187.161 + <body>52.91.187.161 + <h1>hello world</h1>52.91.187.161 + </body>52.91.187.161 +</html>52.91.187.161 52.91.187.161 [2018-05-03T15:34:04+00:00] INFO: Chef Run complete in 37.342504 seconds52.91.187.161 [2018-05-03T15:34:04+00:00] INFO: Chef Run complete in 37.342504 seconds52.91.187.161 52.91.187.161 Running handlers:52.91.187.161 [2018-05-03T15:34:04+00:00] INFO: Running report handlers52.91.187.161 [2018-05-03T15:34:04+00:00] INFO: Running report handlers52.91.187.161 Running handlers complete52.91.187.161 [2018-05-03T15:34:04+00:00] INFO: Report handlers complete52.91.187.161 [2018-05-03T15:34:04+00:00] INFO: Report handlers complete52.91.187.161 Chef Client finished, 2/4 resources updated in 01 minutes 06 seconds
|
| By default, the bootstrap process uses Negotiate authentication and encryption, which helps protect your password and other sensitive information. |
- Troubleshooting
If the operation times out or fails, here are some things to try.
- Ensure that you run
knife commands from your ~/learn-chef directory or one of its sub-directories. - Ensure you have a
~/learn-chef/.chef directory and that it contains a knife.rb file and your RSA private key file. - Ensure that your node's IP address is accessible from your network.
- Ensure the user name you provide has administrator access on the node.
- Ensure your workstation has outbound access (including firewall) on these ports:
- 80 (HTTP)
- 443 (HTTPS)
- 5985 (WinRM)
- Ensure your node has inbound access (including firewall) on these ports:
- Ensure your node has outbound access (including firewall) on these ports:
- The bootstrap process in detail
You can review the documentation to better understand the role of each knife bootstrap option. Here are the options that you used:
--winrm-user--winrm-password--node-name--run-list
You can also watch What happens during knife bootstrap to further understand the process.
2. Confirm the result
Two things just happened.
First, your node was associated with your Chef server. To verify this, run the knife node list command.
Terminal: ~/learn-chef
$ | knife node listnode1-windows
|
You can use the knife node show command to view data about your node.
Terminal: ~/learn-chef
$ | knife node show node1-windowsNode Name: node1-windowsEnvironment: _defaultFQDN: WIN-OPJ5HH81G1B.ec2.internalIP: 52.91.187.161Run List: recipe[learn_chef_iis]Roles: Recipes: learn_chef_iis, learn_chef_iis::defaultPlatform: windows 6.3.9600Tags:
|
The second thing that happened was that your node did an initial check-in with the Chef server and ran the learn_chef_iis cookbook. That's because you specifed learn_chef_iis as the --run-list argument.
To verify the configuration, run curl. Replace the IP address you see here with yours.
Terminal: ~/learn-chef
$ | curl 52.91.187.161<html> <body> <h1>hello world</h1> </body></html>
|
You can also open a web browser from your workstation and navigate to your web server.
