how does node search work

30 views
Skip to first unread message

deepak

unread,
Jun 16, 2012, 2:05:38 PM6/16/12
to littlechef
how does node search work ?
i was going through https://github.com/tobami/littlechef/blob/master/littlechef/lib.py
?

after a chef run is the ohai data of every node stored under the nodes
directory ?

is it a replacement for the chef-server search ?

Miquel Torres

unread,
Jun 16, 2012, 3:00:49 PM6/16/12
to littl...@googlegroups.com
lib.py is mostly about gathering node and cookbook metadata from the JSON files.

How node search works?:

* For every configuration run, the whole repo is rsynced to the node
* What LittleChef does extra is dynamically build a "node" data bag,
with merged attributes, which is also rsynced to the server:
https://github.com/tobami/littlechef/blob/master/littlechef/chef.py#L67
* A cookbook library that adds Chef Solo search is also added to the Chef repo
https://github.com/edelight/chef-solo-search

With that we get search in data bags for Chef Solo, plus if we do
"search(:node, ...", the search will be done inside the autogenerated
node data bag. It then mostly works as a normal Chef Server search.

Does that answer your question?


2012/6/16 deepak <kannan...@gmail.com>:

deepak kannan

unread,
Jun 17, 2012, 12:46:18 AM6/17/12
to littl...@googlegroups.com
the "node" data bag is built from the contents of the nodes folder on the local repo ?

in case, some attribute is dynamically changed. the nodes folder will have to be 
manually edited ?

--
best,
deepak

Miquel Torres

unread,
Jun 17, 2012, 3:17:09 AM6/17/12
to littl...@googlegroups.com
There will be one data bag item for each node in the nodes/ folder of
the local repo, yes. However, the attributes present for that node
will be the same you would find in a Chef Server, that is cookbook
attributes merged with node and role attributes.

What do you mean if "some attribute is dynamically changed"?


2012/6/17 deepak kannan <kannan...@gmail.com>:

deepak kannan

unread,
Jun 17, 2012, 5:24:14 AM6/17/12
to littl...@googlegroups.com
Am trying out chef for the first time
Was reading up on attributes at http://wiki.opscode.com/display/chef/Attributes

If it make a manual change on the server, ohai will pick up those attributes
Also i can set an attribute conditionally in the cookbook as it is ruby.
eg. if it is ubuntu 12.04, super-admin group is called sudo otherwise admin

Am new to chef, so please correct me if i am wrong

Trying to understand if littleshef is a perfect chef-server replacement for search
--
best,
deepak

Miquel Torres

unread,
Jun 17, 2012, 9:35:05 AM6/17/12
to littl...@googlegroups.com
It is not a 100% perfect replacement. As you said, if you rely on
dynamic ohai attributes you won't get those when using LiltteChef,
only those that are defined in the node file. It should be no problem
for you (automated?) VM creation script to add a "distro" attributes
to the new node file. Distribution version is not something that
changes throughout the life of a server.

Dynamic cookbook attributes, it depends, and sometimes it may not work
100% either. Can you describe an example for that as well?


2012/6/17 deepak kannan <kannan...@gmail.com>:

deepak kannan

unread,
Jun 17, 2012, 2:20:39 PM6/17/12
to littl...@googlegroups.com

Dynamic cookbook attributes, it depends, and sometimes it may not work
100% either. Can you describe an example for that as well?


Do not have full control on the cookbooks and would have to read the cookbook source code
Cannot think of a good example for dynamic attribues. But off the top of my head, it would be taking some action based on 
current system state. eg. reconfigure haproxy (loadbalancer) based on load on nodes

Was trying out chef but did not like the overheads of chef-server
My cookbooks and deploy scripts are at https://github.com/deepak/milaap_chef_cookbooks
It is in progress

--
best,
deepak

Reply all
Reply to author
Forward
0 new messages