So I have a need to generate a file tree for certain users on Windows.
I need to provide a list of users, preferably from an external fact, and have puppet make sure a set of files is in a directory (but allowing different unmanaged files), and that directory is named as such: C:\VaultWorkspace\username\Vault
So I'll have as many username directories as there are users specified. I want the username directory and files owned by the username user... My best guess is below, but it doesn't work.
I've seen: Is it possible to use Puppet to ensure multiple files in a directory are present without defining all of them? where it looks like "Of course, with long paths to "/my/dir" or lots of files, it would get a little unwieldy, so in that case you'd be better off creating a define which included the directory path, and just pass the array of filenames to it." is what I want to do, but that post doesn't explain the define...
class inventor {
case $kernel {
'linux': {
}
'windows': {
@file {'VaultWorkspace':
path => "C:/VaultWorkspace/${user}/Vault",
source => "puppet:///modules/inventor/Vault",
recurse => true,
owner => "${user}",
group => 'Users',
mode => 0755,
ensure => present,
}
realize File["$inventorusers"]
}
}
}
$inventorusers = ['username1','username2','usernamen']