How to handle conflicting files in chef? -


i have recipe includes on mysql::server replaces my.cnf file. result on each chef-client run restarts mysql server because my.cnf replaced twice during chef-client run. how avoid that?

update: yes, happens because mysql::server deploys my.cnf , recipe overwrites it. question how disable deployment of my.cnf mysql::server without disabling or modifying cookbook (by using changes in wrapper-cookbook). directly modifying community cookbooks considered bad practice there surely should way achieve desired behaviour using wrapping cookbook.

by sound of this, have 2 template resources being declared my.cnf , 1 of them needs disabled.

without recipes can guess commonly occurs when include mysql::server recipe (which has it's own template resource my.cnf) , specify own template resource my.cnf.

the mysql cookbook allows define configuration using mysql_config resource

mysql_service 'foo'   port '3306'   version '5.5'   initial_root_password 'change me'   action [:create, :start] end  mysql_config 'foo'   source 'my_extra_settings.erb'   notifies :restart, 'mysql_service[foo]'   action :create end 

you need need create my_extra_settings.erb in cookbook


Comments