Scenario: my configuration file is defined by a .erb
file which includes the snippet below.
<% backupclients.each do |backup_files| -%>
Job {
Name = "Server"
JobDefs = "DefaultJob"
Client = <%= backup_files %>-fd
Pool = TeraMonth
Write Bootstrap = "/var/lib/bacula/<%= backup_files %>.bsr"
}
<% end -%>
The server's configuration file needs a repeated entry for each client host. If I were to create a simple array, this would work without issue. What I want to do, however, is have each host register itself and then collect the data using the <<| |>>
pragma similar to what one would do with the nagios_*
types.
The standard example for this involves exporting a type.
class ssh {
@@sshkey { $hostname: type => dsa, key => $sshdsakey }
Sshkey <<| |>>
}
However, I can't quite figure out how to write a type or reference it in a way that would allow me to read that array of values from the .erb
template. Is there a way I can use exported resources in combination with a variable loop in a .erb
file?