How to set node attributes?

821 views
Skip to first unread message

Aaron Hunter

unread,
Apr 3, 2014, 7:14:30 AM4/3/14
to opscode-che...@googlegroups.com
Just starting with Chef and could not find the answer to this in the docs. I want to set host specific attributes such as IP address, partition size, etc. The change should be persistent and settable in way that is version control friendly. I saw that I can set them using a data bag for each host but was hoping there was a simpler built-in mechanism.

Thanks,
Aaron

Darren Birkett

unread,
Apr 3, 2014, 7:32:18 AM4/3/14
to opscode-che...@googlegroups.com
Hi Aaron,

You can edit a particular node manually to add/remove/update attributes, using knife:

knife node edit <mynodename>

Note, though, that ohai will populate the node object with the things you're looking at (IP address, disk configs etc) automatically.  You can see the entire set of node attributes, again using knife:

knife node show <mynodename> -l

Darren



--
You received this message because you are subscribed to the Google Groups "opscode-chef-openstack" group.
To unsubscribe from this group and stop receiving emails from it, send an email to opscode-chef-open...@googlegroups.com.
To post to this group, send email to opscode-che...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/opscode-chef-openstack/cc4a2076-e7f5-441e-ab8c-370a349df865%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Aaron Hunter

unread,
Apr 3, 2014, 8:50:37 AM4/3/14
to opscode-che...@googlegroups.com
Darren,

Thanks for the reply. Forgive my ignorance but will the knife edit method allow me to check in that node configuration change into git? I want to make the change, commit to git, pull and test, then if it's ok push from git to the chef server. I do not want to directly change the node, that would be dangerous.

For Ohai, I assume it can only report the information already set. Which means of course that you need some way of setting it to begin with.


--Aaron

Darren Birkett

unread,
Apr 3, 2014, 9:26:16 AM4/3/14
to opscode-che...@googlegroups.com
Hi Aaron,

a node gets set automatically with all of the system information derived by ohai, at the time the node is registered and chef-client is first run.  You do not need to manually set any of that information up front.

As for managing the node configuration with git, I'm not sure I understand the need.  Generally in chef, you'd not spend a great deal of time manually editing individual node attributes. Attributes are usually set by a cookbook, and the defaults overridden in an environment or recipe if the defaults are not what your use case requires.

All that said, if it's general chef support you're after, you'd be best hitting the chef list ch...@lists.opscode.com. This list is specifically for talking about the openstack chef cookbooks hosted on Stackforge.

Thanks
Darren


--
You received this message because you are subscribed to the Google Groups "opscode-chef-openstack" group.
To unsubscribe from this group and stop receiving emails from it, send an email to opscode-chef-open...@googlegroups.com.
To post to this group, send email to opscode-che...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages