title: In puppet, how to stop a service, perform some action and then start the service?
body: <p>I need to perform some action (configure something) after stopping the tomcat service. Once the configuration is complete, I need to ensure that the tomcat service is up and running again. I have written following puppet code for the same:</p>
  
  <pre><code>Service {'tomcat': ensure =&gt; stopped }
  -&gt;
  class {'config':}
  -&gt;
  Service {'tomcat': ensure =&gt; running }
  </code></pre>
  
  <p>On puppet apply, it is complaining that </p>
  
  <blockquote>
    <p>'Error: Duplicate declaration: Service[tomcat] is already declared in
    file'</p>
  </blockquote>
  
  <p>How to fix this problem. What is the recipe in puppet to stop a service, perform some action and then bring back the service again?</p>