Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How do I iterate through similar "file" resources

My Sample code shown below. How can I simplify this into just one file resource? My collection will so grow to dozens of files, and I could eventually use the recurse => true attribute for file resource.

1) how can I simplify my code

2) will recurse => true purge files that are not managed by puppet (/usr/local/bin) ?

class profiles::freshlocalbin {

  file { 'cls':
    ensure => present,
    path   => '/usr/local/bin/cls',
    mode   => '0755',
    owner  => 'root',
    group  => 'root',
    source => 'puppet:///modules/profiles/freshlocalbin/cls',
  }
  file { 'chenv':
    ensure => present,
    path   => '/usr/local/bin/chenv',
    mode   => '0755',
    owner  => 'root',
    group  => 'root',
    source => 'puppet:///modules/profiles/freshlocalbin/chenv',
  }
}