title: How to handle linux and windows in puppet modules?
body: <p>I have a large Module written for linux systems. But I need it to work for windows so I want to rewrite it to handle both.</p>
  
  <p>There are a lot of manifests and from what I can see so far, most of it should be ok with Windows as puppet would see it's running on windows and select the best provider.</p>
  
  <p>However there are some parts that won't work. As an example this exec will not work on windows</p>
  
  <pre><code>    exec { 'touch_file' :
        command =&gt; 'touch /etc/test.txt',
        path    =&gt; ['/bin', '/usr/bin'],
        cwd     =&gt; '/tmp',
        creates =&gt; '/etc/test.txt',
      }
  </code></pre>
  
  <p>This would work in linux but in Windows I would change this to a powershell command and also change creates, cwd and path. I could change each part to a ${variable} and have a case statement above the Exec statement that picks the right variables based on ::osgroup but I'm not sure if this is the best way to handle this. Is there a better way of handling multi OS modules? </p>