Closed coateds closed 7 years ago
Hello coateds,
The recipe ad-join::default is a shell recipe, it doesn't have any executable code, so your include_recipe 'ad-join::default'
doesn't really do anything, the important part is to have depends 'ad-join'
in your metadata.rb file, which you have, so you're good there.
Lines 21-33 of the domain_join.rb resource are what handle the machine name. Not able to see what happened with your run, if you could provide your debug, might be able to see what happened and offer a suggestion.
What do you mean by "provide your debug"?
pastebin or post here the output from your node from start to finish
Here is the latest section from client.log:
[2017-03-16T16:47:05-07:00] INFO: Run List is [role[ad]]
[2017-03-16T16:47:05-07:00] INFO: Run List expands to [chef-client::default, chef-client::delete_validation, Daves-Test-Cookbook, ad-join, JoinCoatelabDomain]
[2017-03-16T16:47:05-07:00] INFO: Starting Chef Run for server10.coatelab.com
[2017-03-16T16:47:05-07:00] INFO: Running start handlers
[2017-03-16T16:47:05-07:00] INFO: Start handlers complete.
[2017-03-16T16:47:05-07:00] INFO: HTTP Request Returned 404 Not Found:
[2017-03-16T16:47:06-07:00] INFO: HTTP Request Returned 404 Not Found:
[2017-03-16T16:47:06-07:00] INFO: Error while reporting run start to Data Collector. URL: https://server6.coatelab.com/organizations/coatelab/data-collector Exception: 404 -- 404 "Not Found" (This is normal if you do not have Chef Automate)
[2017-03-16T16:47:06-07:00] INFO: Loading cookbooks [chef-client@7.1.0, cron@3.0.0, logrotate@2.1.0, compat_resource@12.16.3, windows@2.1.1, ohai@4.2.3, Daves-Test-Cookbook@0.1.0, ad-join@4.4.0, JoinCoatelabDomain@0.1.0]
[2017-03-16T16:47:07-07:00] INFO: Processing directory[C:/chef/run] action create (chef-client::task line 52)
[2017-03-16T16:47:07-07:00] INFO: Processing directory[C:/chef/cache] action create (chef-client::task line 52)
[2017-03-16T16:47:07-07:00] INFO: Processing directory[C:/chef/backup] action create (chef-client::task line 52)
[2017-03-16T16:47:07-07:00] INFO: Processing directory[C:/chef/log] action create (chef-client::task line 52)
[2017-03-16T16:47:07-07:00] INFO: Processing directory[C:/chef] action create (chef-client::task line 52)
[2017-03-16T16:47:07-07:00] INFO: Processing windows_task[chef-client] action create (chef-client::task line 41)
[2017-03-16T16:47:07-07:00] INFO: windows_task[chef-client] task created
[2017-03-16T16:47:07-07:00] INFO: Processing file[C:\chef\validation.pem] action delete (chef-client::delete_validation line 35)
[2017-03-16T16:47:07-07:00] INFO: Processing registry_key[HKEY_LOCAL_MACHINE\Software\Microsoft\ServerManager] action create (Daves-Test-Cookbook::default line 10)
[2017-03-16T16:47:07-07:00] INFO: Processing domain_join[coatelab] action join (JoinCoatelabDomain::default line 11)
[2017-03-16T16:47:07-07:00] WARN: c:/chef/cache/cookbooks/ad-join/resources/domain_join.rb:67:in `block (2 levels) in class_from_file': property domain is declared in both powershell_script[ad-join] and domain_join[coatelab] action :join. Use new_resource.domain instead. At c:/chef/cache/cookbooks/ad-join/resources/domain_join.rb:67:in `block (2 levels) in class_from_file'
[2017-03-16T16:47:07-07:00] WARN: c:/chef/cache/cookbooks/ad-join/resources/domain_join.rb:79:in `block (2 levels) in class_from_file': property domain is declared in both powershell_script[ad-join] and domain_join[coatelab] action :join. Use new_resource.domain instead. At c:/chef/cache/cookbooks/ad-join/resources/domain_join.rb:79:in `block (2 levels) in class_from_file'
[2017-03-16T16:47:07-07:00] WARN: c:/chef/cache/cookbooks/ad-join/resources/domain_join.rb:82:in `block (2 levels) in class_from_file': property domain is declared in both powershell_script[ad-join] and domain_join[coatelab] action :join. Use new_resource.domain instead. At c:/chef/cache/cookbooks/ad-join/resources/domain_join.rb:82:in `block (2 levels) in class_from_file'
[2017-03-16T16:47:07-07:00] WARN: Cloning resource attributes for windows_task[chef ad-join] from prior resource
Previous windows_task[chef ad-join]: c:/chef/cache/cookbooks/ad-join/resources/domain_join.rb:55:in `block in class_from_file'
Current windows_task[chef ad-join]: c:/chef/cache/cookbooks/ad-join/resources/domain_join.rb:98:in `block in class_from_file' (CHEF-3694)c:/chef/cache/cookbooks/ad-join/resources/domain_join.rb:98:in `block in class_from_file'.
Please see https://docs.chef.io/deprecations_resource_cloning.html for further details and information on how to correct this problem. at C:/opscode/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.19.36-universal-mingw32/lib/chef/event_dispatch/dispatcher.rb:43:in `call'
[2017-03-16T16:47:07-07:00] INFO: Processing reboot[Restart Computer] action nothing (c:/chef/cache/cookbooks/ad-join/resources/domain_join.rb line 32)
[2017-03-16T16:47:07-07:00] INFO: Processing registry_key[warning] action nothing (c:/chef/cache/cookbooks/ad-join/resources/domain_join.rb line 44)
[2017-03-16T16:47:07-07:00] INFO: Processing windows_task[chef ad-join] action create (c:/chef/cache/cookbooks/ad-join/resources/domain_join.rb line 55)
[2017-03-16T16:47:07-07:00] INFO: windows_task[chef ad-join] task already exists - nothing to do
[2017-03-16T16:47:07-07:00] INFO: Processing powershell_script[ad-join] action run (c:/chef/cache/cookbooks/ad-join/resources/domain_join.rb line 65)
[2017-03-16T16:47:14-07:00] INFO: Running queued delayed notifications before re-raising exception
[2017-03-16T16:47:14-07:00] INFO: Running queued delayed notifications before re-raising exception
[2017-03-16T16:47:14-07:00] ERROR: Running exception handlers
[2017-03-16T16:47:14-07:00] ERROR: Exception handlers complete
[2017-03-16T16:47:14-07:00] FATAL: Stacktrace dumped to c:/chef/cache/chef-stacktrace.out
[2017-03-16T16:47:14-07:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
[2017-03-16T16:47:14-07:00] FATAL: Mixlib::ShellOut::ShellCommandFailed: domain_join[coatelab] (JoinCoatelabDomain::default line 11) had an error: Mixlib::ShellOut::ShellCommandFailed: powershell_script[ad-join] (c:/chef/cache/cookbooks/ad-join/resources/domain_join.rb line 65) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '1'
---- Begin output of "C:\Windows\system32\WindowsPowerShell\v1.0\powershell.exe" -NoLogo -NonInteractive -NoProfile -ExecutionPolicy Bypass -InputFormat None -File "C:/Windows/Temp/chef-script20170316-2536-1wclv56.ps1" ----
STDOUT: Skipping computer rename since already named: Server10
STDERR: C:\Windows\Temp\chef-script20170316-2536-1wclv56.ps1 : Missing an argument for
parameter 'DomainName'. Specify a parameter of type 'System.String' and try
again.
+ CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorExcep
tion
+ FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorExceptio
n,chef-script20170316-2536-1wclv56.ps1
---- End output of "C:\Windows\system32\WindowsPowerShell\v1.0\powershell.exe" -NoLogo -NonInteractive -NoProfile -ExecutionPolicy Bypass -InputFormat None -File "C:/Windows/Temp/chef-script20170316-2536-1wclv56.ps1" ----
Ran "C:\Windows\system32\WindowsPowerShell\v1.0\powershell.exe" -NoLogo -NonInteractive -NoProfile -ExecutionPolicy Bypass -InputFormat None -File "C:/Windows/Temp/chef-script20170316-2536-1wclv56.ps1" returned 1
Are you running cookbook 4.12.0?
This is the same issue as documented here: https://github.com/NetDocuments/ad-join-cookbook/issues/19
Either upgrade the cookbook to 4.12.0 or downgrade chef to version older than 12.19
Reopen if that doesn't solve the issue.
I must be missing something obvious. My goal is to run the simplest possible version of this as I learn Chef. I have a small HyperV lab and I am trying to automate the base installation of a Windows server and join it to the domain.
The relevant output in client.log seems to be:
STDOUT: Skipping computer rename since already named: Server10 STDERR: C:\Windows\Temp\chef-script20170316-2196-mstm36.ps1 : Missing an argument for parameter 'DomainName'. Specify a parameter of type 'System.String' and try again.
I do not want to rename the computer at this point, so that is OK. In the wrapper recipe, I am using:
I have never tried to use a 'wrapper' like this in Chef. You see the include_recipe line. I also use: depends 'ad-join' in the metadata.rb and add ad-join to the run list.
What am I missing?
Thanks, Dave