Praveen Kumar Patidar
Praveen Kumar Patidar

Reputation: 77

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. 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.

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

Upvotes: 0

Views: 59

Answers (2)

Praveen Kumar Patidar
Praveen Kumar Patidar

Reputation: 77

We did it via chef-client, so if there is no change it won't affect. 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. so we changed to point it to Chef Environment wherein we defined the variables.

Upvotes: 0

coderanger
coderanger

Reputation: 54249

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. You could build your own control plane to detect data bag changes, but it's not something Chef provides.

Upvotes: 0

Related Questions