How to append a runlist with parameters on bootstrap

Hi,
I’ve been using Chef for a short while and is quite impresive, however I’m trying to do something that will help me reduce some time on the server setup.

I’m not using Chef to push configurations but rather using it kind of in a solo mode to do and maintain builds, but I want to be able to bootstrap the nodes and passing along the users recipie with the data_bag parameter as part of it and I have been unable to find a way to do so. I have not been able to find a way to do so on Chef documentation or by google searches.

Anyone has an idea on how to do this?

Thank you

Could you explain a little more what you mean by

I want to be able to bootstrap the nodes and passing along the users recipie with the data_bag parameter

When bootstrapping, you can use the -j option to pass in attributes

If you are not using a centralized chef server, then you proabably want to convert from chef-solo to chef-zero. Chef zero works with databags (since it is spinning up a local chef server behind the scenes).

Thanks sowen-nd, I did try with -j flag but either my json is very bad or
something isn’t right since it blows everytime not recognizing the json
syntax.

Now, let’s see if I can clear out some things and perhaps explain myself
better.

I’m using a chef server (open source version 12), this may be a simple and
silly thing but while I can mature the configuration I just one to have
oneliner bootstrap that will run the users recepie and pull the data from a
data_bag, but I don’t want to use a require flag on the recepie because it
will tie it up.

I’ve tried something like:

knife bootstrap --sudo -x $user -i ~/.ssh/$key -N $node $actual.node -r
’recepie[users] -j { “users”: { “data_bag”: “$user_list” } }

But it fails everytime regardeless if I scape the double quotes or not, it
seems unable to recognize the {} as valid json syntax which is odd.

Try this

Powershell

$JSON = "{ \`"users\`": { \`"data_bag\`": \`"$user_list\`" } }"
bootstrap -j $JSON

Bash

$JSON = "{ \"users\": { \"data_bag\": \"$user_list\" } }"
bootstrap -j $JSON

Thanks, it was the double quotes before the and after the opening curly
brackets. However it doesn’t seem to be doing anything before, after or
within the -r flag

Any ideas?

Thank you, but I don’t have a Windows box at hand. I have to build a a vm.