简体   繁体   English

根据数据包更改执行厨师食谱

[英]Chef cookbook execution based on databag changes

For the better user access management, we created cookbook for user access and kept the list of users in databag. 为了更好地进行用户访问管理,我们创建了用于用户访问的食谱,并将用户列表保留在databag中。 For each environment there is databag. 对于每种环境,都有数据袋。 Now the issue is, if I add\\update users in databag the cookbook is not getting executing. 现在的问题是,如果我在数据包中添加\\更新用户,则烹饪书无法执行。 PS: The cookbook is looping through the databag. PS:食谱正在遍历数据包。

I have tested with the version as well. 我也测试了版本。 we have environment in chef for environment related variable. 我们在厨师中有与环境相关的变量环境。

I want to run cookbook everytime databag changes or even if that particular cookbook runs everytime, we are ok. 我想每次数据包更改时都运行菜谱,即使该菜谱每次都运行,我们也可以。

Thanks Praveen 感谢Praveen

This is not how Chef works. 这不是厨师的工作方式。 You either run it on a regular schedule (every X minutes) or on-demand via something like SSH or WinRM. 您可以定期(每X分钟)运行它,也可以通过SSH或WinRM按需运行它。 You could build your own control plane to detect data bag changes, but it's not something Chef provides. 您可以构建自己的控制平面来检测数据包的更改,但这不是Chef提供的。

We did it via chef-client, so if there is no change it won't affect. 我们是通过Chef-client完成的,因此,如果没有更改,则不会影响。 If there is change in data bags it will apply. 如果数据袋有变化,则将适用。 The issue with the chef-client is that it wont take the environment variables from bash. Chef-client的问题在于它不会从bash中获取环境变量。 so we changed to point it to Chef Environment wherein we defined the variables. 因此我们更改为指向“厨师环境”,其中定义了变量。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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