chef / knife-windows

Plugin for Chef's knife tool for working with Windows nodes
Apache License 2.0
152 stars 110 forks source link

run_list option not respected when execute knife from PowerShell #422

Closed schmidtaa closed 7 years ago

schmidtaa commented 7 years ago

According to knife doc, an option should allow to specify a particular role, cookbook or recipe to be executed on the node (Windows platform):

installtomcat.ps1:

$runList='recipe[apache::tomcat-install]'

knife winrm 'name:****' chef-client --winrm-user * --winrm-password ***** -r '$runList'

In reality, chef server's run_list only used instead and cookbooks and recipe are executed according to the server's run list.

mwrock commented 7 years ago

I think you want knife bootstrap windows winrm and not knife winrm. The latter simply runs ad hoc commands on the node(s) and therefore a runlist would not be applicable. If you want to simply invoke the chef-client via knife winrm you will need to pass it the full chef-client command.

schmidtaa commented 7 years ago

My scenario: already existing node, need to update/install new cookbook/recipe on that node, so, need knife winrm, not bootstrap.

mwrock commented 7 years ago

oh then you want to call:

knife winrm 'name:********' "chef-client -r '$runList'" --winrm-user ***** --winrm-password *********