How to tell if my config file is latest release


#1

So i have my splunk configuration file input.config on my clients, but I want to make a change and upload to chef to be deployed. What is the best way of checking & handling to ensure the nodes get the file…

template "#{node['splunk']['forwarder']['home']}/etc/system/local/inputs.conf" do source 'inputs.conf.erb' variables :splunk_servers => splunk_servers not_if { File.exists?("#{node['splunk']['forwarder']['home']}/etc/system/local/inputs.conf") } notifies :restart, 'service[SplunkForwarder]' end


#2

Not sure if this helps but the default action for the template resource is to create the file only if it does not exist and does not match the result of your template transform. So your not_if should not be necessary here and it will only converge if the template would result in content different from what is already there. I think thats what you are after.