Hi,
I don't think that nodes performing changes on other nodes is a good use case for chef, nor is it a good idea. This stuff should be in your database cookbook.
If you don't really care about that and just want to do it anyways there are many different ways to do this. I think that the simplest way would have the recipe pass dbm[:fqdn] to an external script to do this for you. Or.. you could just put the whole thing into an execute block in your recipe.
This kind of stuff really belongs in your orchestration or deploy scripts
How do you trigger a deploy right now? Issuing a chef run on your Django server?On Wed, Nov 30, 2011 at 9:42 AM, Kevin Harvey < " target="_blank"> > wrote:
Hello all, I'm trying to keep versioned copies of my database with each new revision of my Django code. I'm working from the Django Quickstart.
In django.rb I have:
...
dbm = nil
# If we are the database master
if node.run_list.roles.include?(app["database_master_role"][0])
dbm = node
else
# Find the database master
results = search(:node, "role:#{app["database_master_role"][0]} AND chef_environment:#{node.chef_environment}", nil, 0, 1)
rows = results[0]
if rows.length == 1
dbm = rows[0]
end
end
...
After this block I have the variable dbm, which should point to the node with the database_master role, whether that's the node I'm on or some other node. (Right?)
Is there a way I can use that variable to run commands just on that node from this recipe? I'd like to do a mysqldump, create a new database with the revision number, and load the dump into it in the before_migration callback in django.rb. Thanks in advance!
--
Kevin Harvey
Web Developer
" target="_blank">
Archive powered by MHonArc 2.6.16.