'Chef Node Attributes. Which ones are avaialble?
I just started using Chef and I've noticed in some recipes there's stuff like node['cpu']['total'].
I searched in questions and online for stuff like "chef node attributes" but I can't find a list of available node attributes.
What I'm looking for is:
- Are all
node[...]defined automatically? - Where can I find a list of all available node attributes (cpu...)?
Solution 1:[1]
Ah! So it's the Ohai recipe/plugin that sets attributes. Specifically the linux/cpu plugin.
Solution 2:[2]
Might help for others in future :
List of all automatic attributes for a node : ( Depends on ohai plugin version)
The list of automatic attributes that are collected by Ohai at the start of each chef-client run vary from organization to organization, and will often vary between the various server types being configured and the platforms on which those servers are run. All attributes collected by Ohai are unmodifiable by the chef-client. To see which automatic attributes are collected by Ohai for a particular node, run the following command:
find /opt/chefdk/embedded/lib/ruby/gems/*/gems/ohai-*/lib -name "*.rb" -print | xargs grep -R "provides" -h |sed 's/^\s*//g'|sed "s/\\\"/\'/g"|sort|uniq|grep "^provides"
Referenced from : https://docs.chef.io/ohai.html
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | iDev247 |
| Solution 2 | Parvez Kazi |
