-
Notifications
You must be signed in to change notification settings - Fork 110
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
knife winrm command parallelism #348
Comments
Was not able to test version 1.0.0.rc.0 or 1.0.0.rc.1 due to runtime errors, but 1.0.0.rc.2 has the same issues. So this was somewhere between 0.8.6 and 1.0.0.rc.2. |
Yeah the parallelism seems like it was lost when em-winrm was deprecated which is indeed unfortunate. Would be cool to get this back. Perhaps with a new gem winrm-multi. |
+1 |
+1 as well |
But it was depreciated because the functionality was put into knife-windows... you can't say it was depreciated because it was placed into knife-windows and then not in knife-windows because it was depreciated... Also if this functionality was dropped for some reason the comments about supporting parallelism should be removed from the description |
Looks like from this commit #94 which I don't know why was approved |
Any update on this issue? I started the charge to get my company's Windows servers under Chef management. But quickly hit a wall where a "knife winrm roles:windows_server chef-client" took 30+ minutes to run across like 10 servers. Which is insane, as the same thing across our 1000 Linux servers takes 5 minutes tops. Watching the console output, it's obviously running chef-client sequentially on each server and waiting for it to finish before moving on to the next. This is still slightly better than logging into each box and clicking buttons in the GUI, but not much. |
Ways to work around the current lack of parallelism in knife winrm. Use one of the following tools to trigger chef-client.
Using pure powershell to
OR You can have a little loop that runs 5 or so in parallel like this:
I started using rundeck + chef push jobs for windows nodes. Unfortunately chef push jobs doesn't have the concept of parallelism either so I wrote a bash script that uses The advantages of this method is you don't have to mess with winrm authentication. #!/bin/bash
# Default variables
chef_search_string=${1:-'chef_environment:test AND role:web-server'}
number_of_nodes=${2:-'1'}
declare -a available_nodes=($(knife node status | grep 'available'| awk '{print $1}'))
declare -a chef_nodes=($(knife search node "${chef_search_string}" -i))
# mktemp creates a random folder in /tmp (you know, for security)
COMMANDS=$(mktemp)
for i in "${chef_nodes[@]}"
do
:
# Filter only nodes with status 'available', save good nodes to script file.
if echo ${available_nodes[@]} | grep -q -w "$i"; then
echo "Adding node ${i} to list"
echo "knife job start 'chef-client' -q 1 $i" >> $COMMANDS
else
echo "Node ${i} is not communicating with chef push jobs server"
fi
done
cat $COMMANDS
echo "Starting push jobs, ${number_of_nodes} at a time...."
# each line in $commands file, is a command to run, gnu parallels executes those commands in batches
parallel --jobs ${number_of_nodes} --halt-on-error 1 < $COMMANDS
exit_code=$?
rm $COMMANDS
exit $exit_code You then call the bash script with a chef search string, and then batch size. E.G.
Its a shame that there isn't an easier way to do orchestration with chef on windows right now. Rumor has it that chef push jobs 2.0 should be out later this year which does support parallel orchestration. |
My colleagues and I stumbled on this issue today and came upon this thread. My colleague downgraded his knife-windows gem and is saying parallel threads work, I'll see it in action tomorrow and report back. I was just wondering if there was any progress here? Are we going to get back parallel threads in knife-windows? |
There are plans to do some fairly serious overhaul to winrm behavior here including better support for powershell, the ability to run commands via scheduled task in addition to the parallelism. Much of this will start after the release of WinRb/WinRM#191 sothat we don't have to overhaul the winrm integration twice. |
When is WinRb/WinRM slated to release? For everyone else coming to this page through Google, my colleague just downgraded his gem to 0.8.6 and got parallelism back. |
+1 |
Just wondering if we will get parallelism back in knife winrm anytime soon? |
Using the latest version of chef-client (12.17.44) and still knife winrm is running serially. Maybe close this issue off if there is no plan on making knife winrm run in parallel over multiple hosts? |
I have a command we run in order to run chef-client on all our windows machines in an environment:
knife winrm "chef_environment:?? AND platform:windows" "chef-client" -x ?? -P ??
When using Chefdk 0.9.0 (with knife-windows 0.8.6) this command executes chef-client on all those machine in parallel, so only taking as long as the longest chef-client run. However using Chefdk 0.10.0 (with knife-windows >= 1.0.0) this command executes chef-client one after another, taking much much longer to run.
Am I missing something? Was parallelism in knife wirm removed?
Thanks
The text was updated successfully, but these errors were encountered: