Hello,
I’m new here, so pls bear with me if this is known and solved prb.
I’m using hosted Chef to manage mail server nodes. chef-client is configured to run in daemon mode on the nodes.
I want to run many one time jobs like say migration of mailstore format from maildir to mbox. Chef provides a good way to execute the jobs without actually doing login to the server. I want to retain that benefit. But when the cookbook is added to runlist, it will execute each time the chef-client executes.
The standard way for one time jobs is Push Jobs, but it is not supported on hosted chef.
So I’ve thought of following approaches to implement the one time jobs :
-
Admin adds cookbook to runlist using Chef gui. Waits for execution to finish. Removes the cookbook from runlist. The cookbooks finish execution within 10 mins. chef-client is configured to run every 30 mins.
-
Admin only adds cookbook. It is removed at some later date. A defensive check is present in the one time cookbooks to check whether it has executed before. I’m little unsure about how can I implement a generic defensive check. I’ve not tested this.
-
Each cookbook has code to automatically remove itself from runlist. I’ve tested this. It works, but I’m little apprehensive that if a later date someone changes it or removes it, the cookbook behaviour will change.
-
Jenkins has a chef plugin to execute cookbooks on given server. We use Jenkins too. So we can do this. But data bags cannot be updated from Jenkins.
I was wondering if I was on a totally wrong path. Is there a simpler way to do this ?
Anybody has used any of the above 4 approaches ?
Thanks in advance,
Amol