Setting attributes on a node


#1

Hi all,

We have recipes that install internally developed applications on nodes. The version of the applications, and the list of applications installed, depends on a combination of a databag and a node attributes and is determined while running a recipe. At the end of this process, we would really like to be able to see the list of installed applications and the versions during knife searches.

We have been thinking of using the recipe to set attributes on the node, but this feels strange to me. I keep worrying that were going to violate the practice of being able to override node attributes. I was thinking maybe we should use ohai to set some properties on the machine, but don’t really know how to do that or if it is the right thing to do.

Any ideas?

Thanks,
Paul


#2

Provided you have a recipe for each application, you will be able to search
by runlist to find the application’s location, searching for
recipe[name_of_app]. Some people use roles for this purpose, but for
various reasons that are out of scope of this thread, I don’t like roles.

I’ve found that setting the version of the application is best done on the
environment level, with a structure like this:

{ “name_of_app” : { “version” : “1.2.3” } }

That way, the upgrade process is just a matter of updating the environment
file in your chef-repo.

On Thu, Oct 18, 2012 at 11:56 AM, Paul McCallick PMcCallick@paraport.comwrote:

Hi all,****


We have recipes that install internally developed applications on nodes.
The version of the applications, and the list of applications installed,
depends on a combination of a databag and a node attributes and is
determined while running a recipe. At the end of this process, we would
really like to be able to see the list of installed applications and the
versions during knife searches.****


We have been thinking of using the recipe to set attributes on the node,
but this feels strange to me. I keep worrying that were going to violate
the practice of being able to override node attributes. I was thinking
maybe we should use ohai to set some properties on the machine, but don’t
really know how to do that or if it is the right thing to do.****


Any ideas?****


Thanks,****

Paul****