简体   繁体   中英

how to bind policy to node in Chef?

I'm new to chef. Recently I'm studying policyfile in chef. But I can only find how to use testkitchen to run the policy, I'm doubting -- if the policy file can only be used in testing? Is there any method to bind it to node like "knife node edit" binding roles to node? Or is there any command like "knife node run_list add node1 'role[webserver],role[appserver]'" to bind multiple policies to node? Thanks

You can only have one policy assigned to a node at a given time in Chef, if you assign the node a policy.

Otherwise, you can set it like a node attribute on the node. The JSON below represents the policy name and policy group you would provide:

{
  "policy_name": "MyChefPolicy",
  "policy_group": "MyPolicyGroup"
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM