Bootstrap on windows


#1

Hi,

I started using chef and got into different behavior on widows than on linux,
while bootstrap on linux the knife bootstrap actually performing the recipes actions and print the output to the screen.
but when bootstrap on windows the command only generate a batch script on the windows machine, then I have to execute it manually in my self.

this is the output of what actually happens:

[root@chef-workstation chef-repo]# knife bootstrap windows winrm 10.100.11.106 --winrm-user ‘chef-win08r2-node\administrator’ --winrm-password ‘**********’ --node-name Win-node --run-list 'role[ora_11201_Win64]'
Node Win-node exists, overwrite it? (Y/N) Y
Client Win-node exists, overwrite it? (Y/N) Y
Creating new client for Win-node
Creating new node for Win-node

Waiting for remote response before bootstrap.10.100.11.106 .
10.100.11.106 Response received.
Remote node responded after 0.0 minutes.
10.100.11.106 AMD64
Bootstrapping Chef on 10.100.11.106
10.100.11.106 Rendering “C:\Users\ADMINI~1\AppData\Local\Temp\bootstrap-4722-1472902123.bat” chunk 1
10.100.11.106 Rendering “C:\Users\ADMINI~1\AppData\Local\Temp\bootstrap-4722-1472902123.bat” chunk 2
10.100.11.106 Rendering “C:\Users\ADMINI~1\AppData\Local\Temp\bootstrap-4722-1472902123.bat” chunk 3
10.100.11.106 Rendering “C:\Users\ADMINI~1\AppData\Local\Temp\bootstrap-4722-1472902123.bat” chunk 4
10.100.11.106 Rendering “C:\Users\ADMINI~1\AppData\Local\Temp\bootstrap-4722-1472902123.bat” chunk 5
10.100.11.106 Rendering “C:\Users\ADMINI~1\AppData\Local\Temp\bootstrap-4722-1472902123.bat” chunk 6
10.100.11.106 Rendering “C:\Users\ADMINI~1\AppData\Local\Temp\bootstrap-4722-1472902123.bat” chunk 7
[root@chef-workstation chef-repo]#
[root@chef-workstation chef-repo]#
[root@chef-workstation chef-repo]#

is it possible to make the process of bootstrap on windows automatic as in linux?

Thanks, Ofir.


#2

Any suggestions?
I saw in examples that the bootstrap also execute the cookbook from remote.
What am I doing wrong?


#3

We have seen this happen on Windows 2008 (not 2008R2) where knife-windows uses an incompatible codepage. In that case, invoking the generated bootstrap-*.bat file simply does nothing and does not invoke the script.

You might try check the temporary directory on the node to see if a .bat file starting with bootstrap- exists. If it does, try running that script via knife winrm -m [your node's IP or FQDN] "[path to .bat file]" Finally if that stalls, try running it in a remote desktop session locally. Neither of these solutions are even close to ideal so please report back with what you found so we can try to better address the core problem.

You might also try installing knife-windows 1.6.0 which has the fix for windows 2008 and you could see if it also fixes your 2008R2 environment. Be aware that version has some new gem dependencies that are incompatible with the current chef-dk. So if you are a chef-dk user, you would be best off installing knife-windows 1.6 via a chef-dk build from our current channel. You can find the latest at https://packages.chef.io/current/windows/2012r2/chefdk-0.18.13-1-x86.msi.


#4

Thanks for the answer!

The server is actually windows server 2008R2.
The bootstrap-*bat script is created in the temp directory, and it is running successfully by local execution.
I tested the bootstrap on 2012 server and it seems to execute the script as well.

so it seems to be a problem with the specific version of windows server as you mention.
also I tried to execute the script from remote as you suggested but it seems like it does nothing:

[root@chef-workstation chef-repo]# knife winrm -m 10.100.11.106 "C:\Users\ADMINI~1\AppData\Local\Temp\bootstrap-3097-1473780267.bat"
Enter your password:
[root@chef-workstation chef-repo]# knife winrm -m 10.100.11.106 --winrm-user ‘chef-win08r2-node\administrator’ --winrm-password ‘*******’ “C:\Users\ADMINI~1\AppData\Local\Temp\bootstrap-3097-1473780267.bat”
[root@chef-workstation chef-repo]#

my workstation and server are linux platform not windows, is it a problem?
should I create another server and work station for windows as well?

Thanks, Ofir.


#5

This should work from linux just as well as from windows. I would first try using knife-windows 1.6.0 to see if the many bug fixes in that release may impact your scenario. As I mentioned before, installing knife-windows 1.6.0 in an existing chef-dk environments may cause gem conflicts. You can alternatively try installing the above linked chef-dk that has all of its gems compatible with knife-windows 1.6.0. We will be officially releasing the new chef-dk (a slightly updated version) next week.