Thank you for the response! First off, normally I would agree with Vladimir’s suggestion – creating a database manually is indeed the easiest way to handle this specific situation. Another easy solution would be to simply keep the database on the same server.
But I was looking for a more generic solution, because I have run into similar types of coordination issue on several other occasions before (and usually resolved them manually)
As for your suggestion, Seth, I am not quite sure I follow how this should work. Step 1 is easy enough. Step 2 is the problem: the owncloud recipe would not be running on the database server, but on the owncloud server which, in my scenario, doesn’t even have permission to create databases. Yes, of course I know that it is possible to create a database remotely with the right permissions, but for a number of reasons, I don’t want to do it that way.
The main reason is that this is really just an example for the more generic scenario. The other reason is that I prefer to keep root access to MySQL limited to the database server.
So the more generic problem is:
Chef recipe runs on server 1, but the final state, and thus the success or failure of the recipe, also depends on something being done on server 2. I’m sure that this is a fairly common scenario; I’m just wondering how others handle it.
From: Seth Thomas [mailto:firstname.lastname@example.org]
Sent: Tuesday, August 19, 2014 9:32 AM
Subject: [chef] Re: How to manage databases with chef?
Coordination as such isn’t required - all you need to make sure of is that MySQL is installed on the DB server and has the user setup before initializing owncloud. There are several ways to do this but here is one possible way:
Run the mysql::server recipe  on the DB server (if mysql is not already installed) and have it create your user
Have the owncloud recipe include a “mysql_database” resource block that creates the owncloud DB using the user creds
Let the owncloud recipe do the rest
There is prior work here so I’d give this repo  a look but note that it assumes that the database is on localhost. It should be easy enough to fork or create your own cookbook. As for protecting secrets one could use encrypted databags/chef-vault/citadel but that is easily it’s own discussion .
On Tue, Aug 19, 2014 at 4:35 AM, <email@example.com mailto:firstname.lastname@example.org > wrote:
What are some best practices for coordinating cookbooks on several different servers? In my example, I have an application (owncloud) that also needs to create a database on another (MySQL) server. I do not want to allow remote root access to that MySQL server.
So the process should be something along the lines of:
On owncloud server: chef-client install owncloud binaries and somehow communicates with chef-client on the database server
On db server: create owncloud database and a user to access this database and communicates the user name and password back.
On owncloud server: continue owncloud configuration
How is this type of scenario best handled in chef?