**Feature Request: Enhance Policyfile Node Management with Optional Auto-Update and Flexible Version Control**

Background:
Currently, Chef Policyfiles enforce strict version control of both policies and cookbooks, requiring explicit chef update and chef push for every change, followed by manually reassigning policies to nodes using knife node policy set. This ensures environment consistency but introduces significant operational overhead, especially in large-scale environments with hundreds or thousands of nodes.

Problem:

  • Every cookbook update requires re-updating and re-pushing all related policies and policy groups, then manually resetting nodes to the updated policies.
  • There is no built-in option for nodes to automatically track and use the latest policy revision or cookbook versions without manual intervention.
  • Current design limits flexibility and agility, making policy adoption cumbersome.
  • In contrast, legacy role/environment-based workflows allowed nodes to implicitly use the latest cookbook versions, easing day-to-day updates.

Proposed Enhancements:

  1. Optional Auto-Update on Nodes:
    Allow nodes to opt-in to automatically use the latest revision of assigned policies, reducing the need for manual knife node policy set commands after each policy update.
  2. Flexible Cookbook Version Referencing in Policies:
    Introduce an option in Policyfiles to reference cookbooks by name only (without locked versions), enabling nodes to pick up the latest cookbook versions automatically, similar to roles/environments.
  3. Granular Control for Users:
    Provide flags or settings to toggle between strict version control (current behavior) and more dynamic version tracking per node or policy group, to suit different operational risk profiles.

Benefits:

  • Streamlines policy and cookbook updates at scale.
  • Reduces operational overhead and human error in large environments.
  • Provides flexibility to balance control and agility.
  • Eases migration from role/environment models to Policyfiles by preserving some familiar behaviors.

Summary:
These enhancements would greatly improve usability and adoption of Policyfiles by offering flexible, scalable workflows while retaining the ability to enforce strict version control where needed.

If nodes are getting policy from infra server they use the version of policy_name assigned to the policy_group the node has been assigned to. Best practices is to have policy_groups like test, dev, qa, prod etc... and a policy change is pushed to lowest group first and after validations everything is working as expected the same policy would be pushed the next lowest group and so on. Only 1 version of a specific policy_name can exist within a policy_group and all nodes assigned to that policy_name and group will get that version and any future updated versions pushed to that policy group.

knife node policy set should only ever be needed when changing the assigned policy or group to a node.

Hi Corey,
Thanks for your reply. I just start the chef-infra, not familiar with it especially for policy related. Seems I misunderstood the policy version control. Based on your explaination,
For example I have a policy with the rev1 and bundled with 2 groups as "test" and "prod", there is a cb with version 1.0 bundle with the policy.
I did some modification on cb and upload to server with new ver 2.0, I update the policy and push to "test" group, now the policy show rev2 with cb-ver2.0 bundles on "test" group.
In this case, those nodes under "test" group, don't have to do set the policy again, the nodes will retrive the latest policy-rev2 with cb-ver2.0 automatically, in the mean time, the nodes under "prod" group still running on policy-rev1 with cb-ver1.0, is that correct?

Thanks & Regards
Steven