ebnius
ebnius

Reputation: 930

chef refresh automatic attribute without a chef-client run

I'd like refresh the automatic attributes on nodes e.g. the .filesystem attribute to get disk space on nodes etc. How can I do that without running sudo chef-client on the nodes? chef-client -o ... doesn't seem to work.

For context I have nodes set up with my chef server along with roles and run lists. Running chef-client would run the corresponding run lists which in some cases I don't want to do (for instance I have a run list that installs and runs a docker image, I only would like to do that occasionally).

Upvotes: 0

Views: 449

Answers (1)

coderanger
coderanger

Reputation: 54191

This is not something Chef supports directly. The closest you could get without major work would be a recipe with just the code node.save which you then run via -o mode. Keep in mind this will change a lot more than just the Ohai data since all the attributes that usually come from cookbooks in the run list expansion will not be present, which is why -o disables the node save in the first place. More generally you could build a tool that runs Ohai and updates only that automatic level attributes, but no such script exists in Chef itself.

Upvotes: 1

Related Questions