厨师windows Bootstrap忽略knife.rb chef_server_url设置

时间:2015-02-23 11:47:06

标签: chef

命令从Chef Workstation转到引导节点:

knife bootstrap windows winrm&lt; <节点的IP> -x&#39;域\用户&#39; -P&#39;密码&#39; -c /home/gwhiting/chef-repo/.chef/knife.rb -l debug

输出:

[2015-02-23T11:10:23+00:00] INFO: *** Chef 12.0.3 ***  
[2015-02-23T11:10:23+00:00] INFO: Chef-client pid: 3056  
[2015-02-23T11:10:34+00:00] INFO: Client key c:/chef/client.pem is not present - registering  
[2015-02-23T11:10:37+00:00] ERROR: Connection refused connecting to http://localhost:8889/clients, retry 1/5  
[2015-02-23T11:10:44+00:00] ERROR: Connection refused connecting to http://localhost:8889/clients, retry 2/5  
[2015-02-23T11:10:51+00:00] ERROR: Connection refused connecting to http://localhost:8889/clients, retry 3/5  
[2015-02-23T11:10:58+00:00] ERROR: Connection refused connecting to http://localhost:8889/clients, retry 4/5  
[2015-02-23T11:11:05+00:00] ERROR: Connection refused connecting to http://localhost:8889/clients, retry 5/5  

Chef encountered an error attempting to create the client "vwd-greg01.org.net"

这是我的knife.rb配置

current_dir = File.dirname(__FILE__)  
log_level                :info  
log_location             STDOUT  
node_name                "admin"  
client_key               "#{current_dir}/admin.pem"  
validation_client_name   "org-validator"  
validation_key           "#{current_dir}/org-validator.pem"  
cache_type               'BasicFile'  
cache_options( :path => "#{ENV['HOME']}/.chef/checksums" )  
cookbook_path            ["#{current_dir}/../cookbooks"]  
chef_server_url          "https://vlu-chefserver.org.net/organizations/org"  
knife[:editor]="/usr/bin/vim"

知道为什么我的chef_server_url在我的厨师运行期间没有被接走? 感谢

完整日志

   [gwhiting@vlu-chefwbench chef-repo]$ knife bootstrap windows winrm  -x 'org_NET\gwhiting'  -l debug

   Waiting for remote response before bootstrap.Enter your password: 
.
   Response received.
   Remote node responded after 0.08 minutes.
   Bootstrapping Chef on 
"Rendering "C:\Users\gwhiting\AppData\Local\Temp\bootstrap-7264-1424700439.bat" chunk 1"
"Rendering "C:\Users\gwhiting\AppData\Local\Temp\bootstrap-7264-1424700439.bat" chunk 2"
"Rendering "C:\Users\gwhiting\AppData\Local\Temp\bootstrap-7264-1424700439.bat" chunk 3"
"Rendering "C:\Users\gwhiting\AppData\Local\Temp\bootstrap-7264-1424700439.bat" chunk 4"
"Rendering "C:\Users\gwhiting\AppData\Local\Temp\bootstrap-7264-1424700439.bat" chunk 5"
"Rendering "C:\Users\gwhiting\AppData\Local\Temp\bootstrap-7264-1424700439.bat" chunk 6"
"Rendering "C:\Users\gwhiting\AppData\Local\Temp\bootstrap-7264-1424700439.bat" chunk 7"
"Rendering "C:\Users\gwhiting\AppData\Local\Temp\bootstrap-7264-1424700439.bat" chunk 8"
"Rendering "C:\Users\gwhiting\AppData\Local\Temp\bootstrap-7264-1424700439.bat" chunk 9"
"Rendering "C:\Users\gwhiting\AppData\Local\Temp\bootstrap-7264-1424700439.bat" chunk 10"
"Rendering "C:\Users\gwhiting\AppData\Local\Temp\bootstrap-7264-1424700439.bat" chunk 11"
"Rendering "C:\Users\gwhiting\AppData\Local\Temp\bootstrap-7264-1424700439.bat" chunk 12"
"Rendering "C:\Users\gwhiting\AppData\Local\Temp\bootstrap-7264-1424700439.bat" chunk 13"
"Rendering "C:\Users\gwhiting\AppData\Local\Temp\bootstrap-7264-1424700439.bat" chunk 14"
"Rendering "C:\Users\gwhiting\AppData\Local\Temp\bootstrap-7264-1424700439.bat" chunk 15"
Checking for existing directory "C:\chef"...
Existing directory found, skipping creation.

C:\Users\gwhiting>(
echo.url = WScript.Arguments.Named("url")
 echo.path = WScript.Arguments.Named("path")
 echo.proxy = null
 echo.Set objXMLHTTP = CreateObject("MSXML2.ServerXMLHTTP")
 echo.Set wshShell = CreateObject( "WScript.Shell" )
 echo.Set objUserVariables = wshShell.Environment("USER")
 echo.
 echo.rem http proxy is optional
 echo.rem attempt to read from HTTP_PROXY env var first
 echo.On Error Resume Next
 echo.
 echo.If NOT (objUserVariables("HTTP_PROXY") = "") Then
 echo.proxy = objUserVariables("HTTP_PROXY")
 echo.
 echo.rem fall back to named arg
 echo.ElseIf NOT (WScript.Arguments.Named("proxy") = "") Then
 echo.proxy = WScript.Arguments.Named("proxy")
 echo.End If
 echo.
 echo.If NOT isNull(proxy) Then
 echo.rem setProxy method is only available on ServerXMLHTTP 6.0+
 echo.Set objXMLHTTP = CreateObject("MSXML2.ServerXMLHTTP.6.0")
 echo.objXMLHTTP.setProxy 2, proxy
 echo.End If
 echo.
 echo.On Error Goto 0
 echo.
 echo.objXMLHTTP.open "GET", url, false
 echo.objXMLHTTP.send()
 echo.If objXMLHTTP.Status = 200 Then
 echo.Set objADOStream = CreateObject("ADODB.Stream")
 echo.objADOStream.Open
 echo.objADOStream.Type = 1
 echo.objADOStream.Write objXMLHTTP.ResponseBody
 echo.objADOStream.Position = 0
 echo.Set objFSO = Createobject("Scripting.FileSystemObject")
 echo.If objFSO.Fileexists(path) Then objFSO.DeleteFile path
 echo.Set objFSO = Nothing
 echo.objADOStream.SaveToFile path
 echo.objADOStream.Close
 echo.Set objADOStream = Nothing
 echo.End if
 echo.Set objXMLHTTP = Nothing
) 1>C:\chef\wget.vbs

C:\Users\gwhiting>(
echo.param(
 echo.   [String] $remoteUrl,
 echo.   [String] $localPath
 echo.)
 echo.
 echo.$webClient = new-object System.Net.WebClient;
 echo.
 echo.$webClient.DownloadFile($remoteUrl, $localPath);
) 1>C:\chef\wget.ps1

C:\Users\gwhiting>(



)
Detected Windows Version 6.3 Build 9600

C:\Users\gwhiting>goto Version6.3

C:\Users\gwhiting>goto Version6.2

C:\Users\gwhiting>goto architecture_select

C:\Users\gwhiting>goto Architecture

C:\Users\gwhiting>goto ArchitectureAMD64

C:\Users\gwhiting>goto install
Checking for existing downloaded package at "C:\Users\gwhiting\AppData\Local\Temp\chef-client-latest.msi"
Found existing downloaded package, deleting.
Attempting to download client package using cscript...

C:\Users\gwhiting>cscript /nologo C:\chef\wget.vbs /url:"https://www.opscode.com/chef/download?p=windows&pv=2012&m=x86_64&v=12" /path:"C:\Users\gwhiting\AppData\Local\Temp\chef-client-latest.msi"
Download via cscript succeeded.
Installing downloaded client package...

C:\Users\gwhiting>msiexec /qn /log "C:\Users\gwhiting\AppData\Local\Temp\chef-client-msi6022.log" /i "C:\Users\gwhiting\AppData\Local\Temp\chef-client-latest.msi"
WARNING: Failed to install Chef Client MSI package in remote context with status code 1603.
WARNING: This may be due to a defect in operating system update KB2918614: http://support.microsoft.com/kb/2918614
WARNING: Saving installation log of failure at "C:\Users\gwhiting\AppData\Local\Temp\chef-client-msi6022.log-fail.log"
WARNING: Retrying installation with local context...
WARNING: Task may not run because /ST is earlier than current time.
SUCCESS: The scheduled task "chefclientbootstraptask" has successfully been created.
Successfully created scheduled task to install Chef Client.
SUCCESS: Attempted to run the scheduled task "chefclientbootstraptask".
Successfully started Chef Client installation scheduled task.
Waiting for installation to complete -- this may take a few minutes...

    SUCCESS: Signal received.
    Finished waiting for Chef Client package to install.
    Installation completed successfully
    Writing validation key...
    Validation key written.

C:\Users\gwhiting>(
echo.log_level        :info
 echo.log_location     STDOUT
 echo.
 echo.chef_server_url  "http://localhost:8889"
 echo.validation_client_name "org-validator"
 echo.client_key        "c:/chef/client.pem"
 echo.validation_key    "c:/chef/validation.pem"
 echo.
 echo.file_cache_path   "c:/chef/cache"
 echo.file_backup_path  "c:/chef/backup"
 echo.cache_options     ({:path => "c:/chef/cache/checksums", :skip_expires => true})
 echo.
 echo.# Using default node name (fqdn)
) 1>C:\chef\client.rb

C:\Users\gwhiting>(echo.{"run_list":[]}) 1>C:\chef\first-boot.json
Starting chef to bootstrap the node...

C:\Users\gwhiting>SET "PATH=C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;c:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\;C:\opscode\chef\bin;C:\ProgramData\chocolatey\bin;C:\Users\gwhiting\AppData\Roaming\Boxstarter;C:\ruby\bin;C:\opscode\chef\bin;C:\opscode\chef\embedded\bin"

C:\Users\gwhiting>chef-client -c c:/chef/client.rb -j c:/chef/first-boot.json -E _default
[2015-02-23T14:08:03+00:00] INFO: *** Chef 12.0.3 ***
[2015-02-23T14:08:03+00:00] INFO: Chef-client pid: 252
[2015-02-23T14:08:26+00:00] INFO: Client key c:/chef/client.pem is not present - registering
[2015-02-23T14:08:29+00:00] ERROR: Connection refused connecting to http://localhost:8889/clients, retry 1/5
[2015-02-23T14:08:36+00:00] ERROR: Connection refused connecting to http://localhost:8889/clients, retry 2/5
[2015-02-23T14:08:43+00:00] ERROR: Connection refused connecting to http://localhost:8889/clients, retry 3/5
[2015-02-23T14:08:50+00:00] ERROR: Connection refused connecting to http://localhost:8889/clients, retry 4/5
[2015-02-23T14:08:57+00:00] ERROR: Connection refused connecting to http://localhost:8889/clients, retry 5/5

================================================================================
Chef encountered an error attempting to create the client "vwd-greg01.org.net"
================================================================================

Network Error:
--------------
There was a network error connecting to the Chef Server:
No connection could be made because the target machine actively refused it. - Connection refused connecting to http://localhost:8889/clients, giving up

Relevant Config Settings:
-------------------------
chef_server_url  "http://localhost:8889"

If your chef_server_url is correct, your network could be down.

[2015-02-23T14:09:05+00:00] FATAL: Stacktrace dumped to c:/chef/cache/chef-stacktrace.out
[2015-02-23T14:09:05+00:00] FATAL: NoMethodError: undefined method `run_id' for nil:NilClass
ERROR: Failed to execute command on  return code 1
[gwhiting@vlu-chefwbench chef-repo]$

1 个答案:

答案 0 :(得分:1)

我在这里找到答案:https://github.com/chef/chef/issues/2796 问题是-l debug。这不是刀具引导命令的有效语法,它在某种程度上导致刀子尝试使用厨师零