[chef] Re: Passing run_list to windows node which is to be bootstrapped.


Chronological Thread 
  • From: "Steven Murawski" < >
  • To: "" < >
  • Subject: [chef] Re: Passing run_list to windows node which is to be bootstrapped.
  • Date: Tue, 14 Jul 2015 09:19:03 -0500

You are hitting a problem with parsing.. PowerShell does some processing of the parameters and then Ruby does some attempted globbing on the inbound parameters.

There is a PowerShell module shipping with 12.4.0 and newer and will be in the next ChefDK (0.7.0) to help with that.

Options are:

If you are running PowerShell 3 or newer, you can use --% to prevent PowerShell from interpreting your args. (you wouldn't be able to pass those variables you list though).  You'd have to do some string building ahead of time and eval that..

knife bootstrap windows winrm $ServerIP --auth-timeout 1 -N $computerNameTag --bootstrap-version "12.3.0" -x $login -P $DBServerPassword --% -r 'role[eu1],role[db],role[sx],recipe[push-jobs],recipe[hello::ZabbixAgentInstUpd]'

Otherwise, you can run knife from cmd.exe.

There is some crazy triple quoting you can do, but I don't recommend that if you intend to stay sane. ;)

Steve

Steven Murawski
Community Software Development Engineer @ Chef
Microsoft MVP - PowerShell
http://stevenmurawski.com

On 7/14/2015 4:03:49 AM, Taras Klym < > wrote:

Hi guys,

I am doing some scripting for automatic servers creation on AWS side and bootstrapping it. 

Here are some parameters I compose for passing to bootstrap command:
$role='role[eu1],role[db],role[sx]'
$runlist = "$role,recipe[push-jobs],recipe[hello::ZabbixAgentInstUpd]"
$login = "Administrator"
$tag = $Env

And here is command by itself:
knife bootstrap windows winrm $ServerIP --auth-timeout 1 -N $computerNameTag --bootstrap-version "12.3.0" -r $runlist -x $login -P $DBServerPassword

I have just realized that after node is bootstrapped it doesn't have roles assigned.

So the main question is as follow:
Is passed "runlist" to node during bootstrap stays assigned to node after first chef-client run completed or it's just "runlist" for bootstrap?
And actually at the end node doesn't have any roles/recipes assigned to it which were passed during bootstrap?

Thank you all guys kin advance for your clarifications. 

Regards,
Taras.



Archive powered by MHonArc 2.6.16.

§