title: Vagrant - Chef - templatefile check
body: <p>how do I get it out to test whether there is a template file.</p>
  
  <p>I want to load the webserver default.conf.erb only if there is no other appropriate config there.</p>
  
  <p>I had thought so, but without success.</p>
  
  <pre><code>template "#{node[:nginx][:dir]}/sites-available/#{host_name}.loc.conf" do
          variables attribs
  
          if File.exists? ("/templates/default/#{host_name}.conf.erb")
              source "#{host_name}.conf.erb"
          else
              source "default.conf.erb"
          end
  
          notifies :reload, "service[nginx]"
  end
  </code></pre>