Skip to content

Instantly share code, notes, and snippets.

@qhartman
Created April 10, 2013 19:35
Show Gist options
  • Save qhartman/5357739 to your computer and use it in GitHub Desktop.
Save qhartman/5357739 to your computer and use it in GitHub Desktop.
#The original template resource def:
template "#{node['mysql']['conf_dir']}/my.cnf" do
source "my.cnf.erb"
owner "root" unless platform_family? 'windows'
group node['mysql']['root_group'] unless platform_family? 'windows'
mode "0644"
case node['mysql']['reload_action']
when 'restart'
notifies :restart, resources(:service => "mysql"), :immediately
when 'reload'
notifies :reload, resources(:service => "mysql"), :immediately
else
Chef::Log.info "my.cnf updated but mysql.reload_action is #{node['mysql']['reload_action']}. No action taken."
end
variables :skip_federated => skip_federated
end
# I want to Use our custom config template instead, but this doesn't work
edit "template[#{node['mysql']['conf_dir']}/my.cnf]" do
source "mysql/my.cnf.erb"
end
# Neither does this
edit "template[/etc/my.cnf]" do
source "mysql/my.cnf.erb"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment