I need to put an action inside a resource into a conditional. If the
condition is true, then include that action, if not, don’t. How can I do
this in chef?
eg:
template “/usr/share/tomcat7/bin/setenv.sh” do
source "usr/share/tomcat7/bin/setenv.sh.erb"
owner 'root’
group 'root’
mode '0644’
backup false
Only include the ‘notifies’ line below if some condition is true.
notifies :restart, ‘service[tomcat7]’, :delayed if
node[‘tomcat’][‘tomcat_service_states’].include? 'start’
variables(
:config => node[‘tomcat’]
)
end
Thanks,
Doug.