I am attempting to populate some configuration files from modules/apt_config/files using a defined resource and an array of files to install.
define aptfile($file) {
file { $file: source => "puppet:///modules/${module_name}/etc/apt/${file}", }
}
aptfile{ [ 'apt.conf', 'sources.list', ]: }
According to this bug report, $module_name should be available. That part isn't causing me grief. What seems to be broken is that way that $file is not being populated when I call the resource; instead, I get the following error:
Must pass file to Apt_config::Aptfile[apt.conf] at /tmp/vagrant-puppet/modules-0/apt_config/manifests/init.pp:10 on node vagrant.home
Note that line 10 is the line containing the define aptfile definition.
The syntax is a little arcane. So, just in case I was specifying the file path backwards, I also tried this:
define aptfile($file) {
file { "/etc/apt/${file}":
source => "puppet:///modules/${module_name}/${file}",
}
}
aptfile{ [ 'apt.conf', 'sources.list', ]: }
with identical results. I know I could specify each file individually, but what do I need to do to make this loop work properly?