0

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.

Disco
  • 4,226
  • 11
  • 58
  • 76
  • http://meta.stackexchange.com/questions/66377/what-is-the-xy-problem Really your question is, "How can create database users dynamically?" – EnabrenTane Nov 23 '12 at 13:05

1 Answers1

1

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.

EnabrenTane
  • 7,428
  • 2
  • 26
  • 44