title: Run custom services on startup with puppet
body: <p>I'm migrating our old process of doing our linux configurations to be managed by puppet but I'm having issues trying to figure out how to do this. We add some custom scripts to the init.d folder on our systems to manage some processes, and then these need this command executed on them to launch on startup:</p>
  
  <pre><code>update-rc.d $file defaults
  </code></pre>
  
  <p>So what I'm doing with puppet is that I have all these scripts residing a directory, and I copy them over to init.d. I then want to call 'exec' on each of these files with the former command and use the file name as an argument. This is what I have so far:</p>
  
  <pre><code>#copy init files    
  file { '/etc/init.d/':
        ensure =&gt; 'directory',
        recurse =&gt; 'remote',
        source =&gt; ["puppet:///files/init_files/"],
        mode =&gt; 755,
        notify =&gt; Exec[echo],
      }
  
  exec { "echo":
    command =&gt; "update-rc.d $file defaults",
    cwd =&gt; "/tmp", #directory to execute from
    path =&gt; "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:",
    refreshonly =&gt; true
  }
  </code></pre>
  
  <p>This will copy all the files and it calls exec when something is added/updated, but what I can't figure out is how to pass the name of the file as an argument into the exec command. It seems I'm really close but I just can't find anything to help with what I need to do. Is this the right way to try and achieve this?</p>
  
  <p>Thanks.</p>