Reputation: 4386
I'm using chef-solo, to avoid the headache of having multiple instance to manage (correct me if you think this is not a good idea)
I have defined a 'database' role; I cook it with chef-solo on the target node.
Now, I want a way to create new users to database 'dynamically'
Like engine yard, where you can hit the 'create database' button and that triggers a new database creation.
Should I set up a cronjob that continuously fetches the run list from an URL ? What should I put in that URL ? I don't want to re-install the whole cookbook.
Upvotes: 0
Views: 166
Reputation: 7466
Answering the question, "How do I create database users dynamically?" I would say the following.
If you are using chef-solo with a cron job to hit a URL, you are reinventing chef-client + chef-server minus the security.
You also should be able to run the cookbook again, and it shouldn't break anything.
It sounds like you should run chef-client and store the user information in a databag.
It looks Like John(Lusis) already did the adding user part. https://gist.github.com/769365
To trigger it "dynamically" you can either use knife/ssh or make a cgi script that runs chef-client on the node. I would suggest the ssh approach.
Upvotes: 1