[英]Is there a way for a Chef recipe to continue after a reboot (Windows)?
[英]Chef reboot resource causes chef run to time out before Windows server is able to start back up after update and resume recipe
我正在嘗試在Windows 2012 R2服務器上創建域,並且需要重新啟動才能繼續執行配方:
reboot "reboot server" do
reason "init::chef - continue provisioning after reboot"
action :reboot_now
end
我收到以下錯誤,表示超時+它發生在我看到操作系統在更新后恢復正常之前。
Failed to complete #converge action: [WinRM::WinRMAuthorizationError] on default-windows2012r2
有人備份操作系統后,是否知道如何使Chef服務器繼續運行? 我聽說:restart_now
應該可以解決問題... ^^^但您可以看到,它不是:)
PS這也會導致Windows更新...目標:讓廚師在更新完成且服務器已備份后恢復
更新 :服務器實際上似乎在重新引導兩次,並退出在第二次重新引導時運行的廚師。 如果我刪除了一個重啟資源塊,那么它根本就不會重啟(這對我來說沒有意義)...這是廚師運行的輸出:
Chef Client finished, 2/25 resources updated in 19 seconds
[2018-10-29T08:04:11-07:00] WARN: Rebooting server at a recipe's request. Details: {:delay_mins=>0, :reason=>"init::chef - continue provisioning after reboot", :timestamp=>2018-10-29 08:04:11 -0700, :requested_by=>"reboot server"}
Running handlers:
[2018-10-29T08:04:11-07:00] ERROR: Running exception handlers
Running handlers complete
[2018-10-29T08:04:11-07:00] ERROR: Exception handlers complete
Chef Client failed. 2 resources updated in 20 seconds
[2018-10-29T08:04:11-07:00] FATAL: Stacktrace dumped to C:/Users/vagrant/AppData/Local/Temp/kitchen/cache/chef-stacktrace.out
[2018-10-29T08:04:11-07:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
[2018-10-29T08:04:11-07:00] FATAL: Chef::Exceptions::Reboot: Rebooting server at a recipe's request. Details: {:delay_mins=>0, :reason=>"init::chef - continue provisioning after reboot", :timestamp=>2018-10-29 08:04:11 -0700, :requested_by=>"reboot server"}
重復兩次的^^^
更新#2 :我什至注釋掉除了重新啟動塊以外的每一行,並且遇到相同的問題...這太荒謬了,我確信不是我的代碼才是問題所在(考慮到我正在使用的所有內容)現在是重新啟動命令)。
更新#3 :我生成了一個全新的食譜,並將其稱為“重新啟動” ...它包含以下代碼:
reboot 'app_requires_reboot' do
action :request_reboot
reason 'Need to reboot when the run completes successfully.'
end
不幸的是,它也兩次重啟了Windows服務器...這是日志:
Recipe: reboot::default
* reboot[app_requires_reboot] action request_reboot[2018-10-29T10:21:41-07:00] WARN: Reboot requested:'app_requires_reboot'
- request a system reboot to occur if the run succeeds
Running handlers:
Running handlers complete
Chef Client finished, 1/1 resources updated in 03 seconds
[2018-10-29T10:21:41-07:00] WARN: Rebooting server at a recipe's request. Details: {:delay_mins=>0, :reason=>"Need to reboot when the run completes successfully.", :timestamp=>2018-10-29 10:21:41 -0700, :requested_by=>"app_requires_reboot"}
Running handlers:
[2018-10-29T10:21:41-07:00] ERROR: Running exception handlers
Running handlers complete
[2018-10-29T10:21:41-07:00] ERROR: Exception handlers complete
Chef Client failed. 1 resources updated in 03 seconds
[2018-10-29T10:21:41-07:00] FATAL: Stacktrace dumped to C:/Users/vagrant/AppData/Local/Temp/kitchen/cache/chef-stacktrace.out
[2018-10-29T10:21:41-07:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
[2018-10-29T10:21:41-07:00] FATAL: Chef::Exceptions::Reboot: Rebooting server at a recipe's request. Details: {:delay_mins=>0, :reason=>"Need to reboot when the run completes successfully.", :timestamp=>2018-10-29 10:21:41 -0700, :requested_by=>"app_requires_reboot"}
似乎現在是Chef的問題...這很糟糕...誰曾經與Chef一起成功重啟過Windows? 為什么一次重啟阻止一次,兩次重啟服務器?
更新編號4將在我將計算機扔出窗戶之后
該問題已通過以下邏輯得到解決:
reboot "reboot server" do
reason "init::chef - continue provisioning after reboot"
action :nothing
only_if {reboot_pending?}
end
如果操作系統未檢測到有Windows更新待處理,則添加“僅if”語句將使配方跳過該步驟。
我忘記了Windows確實會跟蹤是否需要系統更新/重啟。
作為我的poweshell_script塊的一部分,我包括以下內容: notifies :reboot_now, 'reboot[reboot server]', :immediately
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.