Closed MattMencel closed 9 years ago
Hi @MattMencel - One way I've handled similar situations was creating "installed" or "configured" files that are either empty files, or files containing the timestamp of when something was installed/configured. An example would be to do something like this in your wrapper cookbook:
unless File.exist?(File.join(node[:wordpress][:dir], '.installed'))
include_recipe 'wordpress'
require 'time'
inst_date = Time.new.rfc2822
bash 'Touch .installed flag' do
cwd node[:magento][:dir]
code <<-EOH
echo '#{inst_date}' > #{File.join(node[:wordpress][:dir], '.installed')}
EOH
end
end
By invoking this WordPress cookbook from within this block wouldn't be run more than once. The trade-off here being that nothing would ever be run, so if someone/something changed a file or removed a file, the next chef run wouldn't fix it.
I haven't started work on it, but one day, I'd like to setup a LWRP (see #33) for use of setting up the site to make this cookbook more portable, so you can consume as much or as little of this cookbook as you'd like. If the LWRP is in place you could conceivably point to your own nginx or Apache configuration.
I hope this helps!
Hi,
I use this in a wrapper cookbook and need to add some web proxy configs and the extra configs for multisite to the wp-config.php file. However when Chef runs it overwrites that file from the template.
Do you have a particular way you are handling that in your wrapper cookbooks?
Matt