Setting variables of a cookbook using a ruby-script


#1

Hi! I was wondering if it is possible to set the variables of a cookbook by
using a ruby script? I tought about fetching a cookbook, setting its variables
then storing it in the run_list of a node.
Is that possible?

Greetings,
Mat


#2

On Sun, Feb 21, 2010 at 5:04 PM, matthias@splieth.com wrote:

Hi! I was wondering if it is possible to set the variables of a cookbook by
using a ruby script? I tought about fetching a cookbook, setting its variables
then storing it in the run_list of a node.
Is that possible?

Matthias, what exactly is your use case here?

You can set variables in a cookbook using ‘attributes’ files, and you
can point the chef client at a JSON file at run time. In either case,
if you are using the chef-client command, you’ll get the data stored
on the Chef server.

Adam


Opscode, Inc.
Adam Jacob, CTO
T: (206) 508-7449 E: adam@opscode.com


#3

Hi Adam!

I want a user to specify parameters he wants to be set in a cookbook.
But he shouldn’t see cookbook itself.
E.g. something like

install :apache2, :attributes => { … }

Adam Jacob wrote:

On Sun, Feb 21, 2010 at 5:04 PM, matthias@splieth.com wrote:

Hi! I was wondering if it is possible to set the variables of a cookbook by
using a ruby script? I tought about fetching a cookbook, setting its variables
then storing it in the run_list of a node.
Is that possible?

Matthias, what exactly is your use case here?

You can set variables in a cookbook using ‘attributes’ files, and you
can point the chef client at a JSON file at run time. In either case,
if you are using the chef-client command, you’ll get the data stored
on the Chef server.

Adam