Search code examples
puppetpuppet-enterprise

How do I define the directory in init.pp?


My init.pp looks like below:

class checkout {
 file { '/etc/example/test/testcv.sh':
ensure   => present,
owner => 'root',
mode => '0755',
content => template('checkout/testcv.sh.erb')
}
}

What this does is, copies testcv.sh to my /etc/example/test/ in all my hosts automatically. But if I have to copy the directory to the certain location what resource type should I use? I tried replacing file with "dir" but it didn't work.


Solution

  • The file resource is also used to create directories by changing the ensure parameter to directory.

    file { '/etc/example/test':
      ensure => directory
      ...
      ...
    }