Overriding Chef run list but keep using node attributes

Is there a way to use chef-client's -o command to override the run list but also still keep using the existing node attributes?

As mentioned here when you override the run list with chef-client -o ... then the node attributes are consequently no longer applied.

Upvotes: 3

Views: 889

Answers (2)

Luis Davim
Luis Davim

Reputation: 111

If you pass the environment with -E it should preserve the attributes.

Upvotes: -1

coderanger
coderanger

Reputation: 54181

I don't think that comment is entirely correct. Override run lists should have no effect on attributes set on the node directly, and attributes from things on the run list happen as per normal. If you are asking if there is a way to load attributes from all your primary run list entries and their dependencies, but only run a specific subset of the recipes, I'm not aware of a general solution for that. For a specific case you could make a dummy cookbook that depends on all the things in the primary run list with a single blank recipe, and include that as the first item of the override run list. You can't do that dynamically though, so you would need one such dummy cookbook for each situation where this comes up.

Upvotes: 2

Related Questions