- From: Marcel Cary <
>
- To:
- Subject: [chef] Overriding grants for MySQL cookbook?
- Date: Thu, 19 May 2011 15:09:00 -0700
How do I override grants.sql for the mysql cookbook?
The recipe looks like it's designed to have me declare my own template
resource. But when I do, I have problems with execution timing. Here are
some alternatives I've tried:
A: I declare my own template by that name and leave the default :create
action. But the grants run before the server is up.
B: I set a :nothing action on my own template declaration. But the grants
never run.
C: I don't declare my own template and hope Chef finds my
[cookbook]/templates/default/grants.sql.erb to override mysql's. But mysql's
gets used instead.
I can work around by adding an execute resource below, but I feel like I'm
missing something, or that this is harder/hackier than it should be:
execute "touch /etc/mysql/grants.sql.create" do
not_if "test -f /etc/mysql/grants.sql.create"
notifies :create, resources("template[/etc/mysql/grants.sql]"), :immediately
end
My custom grants.sql creates a single database user and schema and grants
that user access to (a prefix pattern of) that schema. Is there a better way
to accomplish that?
Thanks,
Marcel M. Cary
- [chef] Overriding grants for MySQL cookbook?, Marcel Cary, 05/19/2011
Archive powered by MHonArc 2.6.16.